Example #1
0
        /// <summary>
        /// Opens a file identified by a URI for read or write.
        /// </summary>
        /// <param name="uri"></param>
        /// <param name="mode"></param>
        /// <returns></returns>
        /// <remarks>
        /// If not set explicitly through properties, compression and archival settings
        /// are figured out automatically from the file extension.
        /// </remarks>
        public Stream Open(Uri uri, DataFileMode mode)
        {
            this.uri  = uri;
            this.mode = mode;

            return(Open());
        }
        public SqlServerNativeDataFile(Stream stream, DataFileMode fileMode)
            : base(stream, fileMode)
        {
            InitializeMembers();

            Open();
        }
        public SqlServerNativeDataFile(Uri uri, DataFileMode fileMode)
            : base(uri, fileMode)
        {
            InitializeMembers();

            Open();
        }
Example #4
0
        public DelimitedTextDataFile(Stream stream, DataFileMode fileMode, Encoding encoding, CultureInfo culture)
            : base(stream, fileMode, encoding, culture)
        {
            InitializeMembers(new StreamingContext());

            Open();
        }
        public SqlServerNativeDataFile(Stream stream, DataFileMode fileMode)
            : base(stream, fileMode)
        {
            InitializeMembers();

            Open();
        }
Example #6
0
        /// <summary>
        /// Opens a file by wrapping a stream.
        /// </summary>
        /// <param name="stream"></param>
        /// <param name="mode"></param>
        /// <param name="compression"></param>
        protected void OpenExternalStream(Stream stream, DataFileMode fileMode)
        {
            this.baseStream     = stream;
            this.ownsBaseStream = false;

            this.fileMode = fileMode;
        }
Example #7
0
        /// <summary>
        /// Constructs a file and opens a stream automatically.
        /// </summary>
        /// <param name="uri"></param>
        /// <param name="fileMode"></param>
        /// <param name="compression"></param>
        protected DataFileBase(Uri uri, DataFileMode fileMode)
        {
            InitializeMembers(new StreamingContext());

            this.uri      = uri;
            this.fileMode = fileMode;
        }
        public DelimitedTextDataFile(Stream stream, DataFileMode fileMode, Encoding encoding, CultureInfo culture)
            : base(stream, fileMode, encoding, culture)
        {
            InitializeMembers(new StreamingContext());

            Open();
        }
Example #9
0
        public CsvFile(Stream stream, DataFileMode fileMode, CompressionMethod compression, Encoding encoding, CultureInfo culture)
            : base(stream, fileMode, compression, encoding, culture)
        {
            InitializeMembers();

            Open();
        }
        public SqlServerNativeDataFile(Uri uri, DataFileMode fileMode)
            : base(uri, fileMode)
        {
            InitializeMembers();

            Open();
        }
        protected FormattedDataFileBase(Stream stream, DataFileMode fileMode, Encoding encoding, CultureInfo culture)
            : base(stream, fileMode)
        {
            InitializeMembers(new StreamingContext());

            this.encoding = encoding;
            this.culture  = culture;
        }
Example #12
0
        protected FormattedDataFile(Stream stream, DataFileMode fileMode, CompressionMethod compression, Encoding encoding, CultureInfo culture)
            : base(stream, fileMode, compression)
        {
            InitializeMembers();

            this.encoding = encoding;
            this.culture = culture;
        }
Example #13
0
        /// <summary>
        /// Opens a file identified by a URI for read or write.
        /// </summary>
        /// <param name="uri"></param>
        /// <param name="mode"></param>
        /// <param name="compression"></param>
        /// <param name="archival"></param>
        /// <returns></returns>
        public Stream Open(Uri uri, DataFileMode mode, DataFileCompression compression, DataFileArchival archival)
        {
            this.uri         = uri;
            this.mode        = mode;
            this.compression = compression;
            this.archival    = archival;

            return(Open());
        }
Example #14
0
        /// <summary>
        /// Initializes private member variables.
        /// </summary>
        private void InitializeMembers()
        {
            this.uri         = null;
            this.mode        = DataFileMode.Read;
            this.compression = DataFileCompression.Automatic;
            this.archival    = DataFileArchival.Automatic;

            this.userName = null;
            this.password = null;
        }
Example #15
0
        /// <summary>
        /// Opens a file by wrapping an external file stream
        /// </summary>
        /// <param name="stream"></param>
        /// <param name="fileMode"></param>
        public void Open(Stream stream, DataFileMode fileMode)
        {
            if (stream == null)
            {
                throw new ArgumentNullException("stream");  // TODO
            }

            OpenExternalStream(stream, fileMode);
            Open();
        }
Example #16
0
        /// <summary>
        /// Opens a file by opening a new stream.
        /// </summary>
        /// <param name="uri"></param>
        /// <param name="fileMode"></param>
        public void Open(Uri uri, DataFileMode fileMode)
        {
            if (uri == null)
            {
                throw new ArgumentNullException("uri"); // TODO
            }

            this.uri      = uri;
            this.fileMode = fileMode;

            Open();
        }
Example #17
0
        private void InitializeMembers(StreamingContext context)
        {
            this.baseStream        = null;
            this.ownsBaseStream    = false;
            this.streamFactoryType = null;

            this.fileMode = DataFileMode.Unknown;
            this.uri      = null;
            this.generateIdentityColumn = false;

            this.blocks       = new List <DataFileBlockBase>();
            this.blockCounter = -1;
        }
Example #18
0
        private void CopyMembers(DataFileBase old)
        {
            this.baseStream     = null;
            this.ownsBaseStream = false;

            this.fileMode = old.fileMode;
            this.uri      = old.uri;
            this.generateIdentityColumn = old.generateIdentityColumn;

            // Deep copy of blocks
            this.blocks = new List <DataFileBlockBase>();
            foreach (var b in old.blocks)
            {
                var nb = (DataFileBlockBase)b.Clone();
                this.blocks.Add((DataFileBlockBase)b.Clone());
            }

            this.blockCounter = -1;
        }
        protected void Open(DataFileMode fileMode, DataFileArchival archival)
        {
            EnsureNotOpen();

            if (baseStream == null)
            {
                // Open input stream
                // Check if the archival option is turned on and open archive
                // file if necessary by opening an IArchiveInputStream

                var sf = GetStreamFactory();
                sf.Uri      = uri;
                sf.Mode     = fileMode;
                sf.Archival = archival;
                // TODO: add authentication options here

                baseStream     = sf.Open();
                ownsBaseStream = true;
            }
            else
            {
                // Do nothing
            }
        }
Example #20
0
        /// <summary>
        /// Initializes private member variables.
        /// </summary>
        private void InitializeMembers()
        {
            this.uri = null;
            this.mode = DataFileMode.Read;
            this.compression = DataFileCompression.Automatic;
            this.archival = DataFileArchival.Automatic;

            this.userName = null;
            this.password = null;
        }
Example #21
0
 public DelimitedTextDataFile(Uri uri, DataFileMode fileMode)
     : this(uri, fileMode, Encoding.ASCII, CultureInfo.InvariantCulture)
 {
     // Overload
 }
Example #22
0
        /// <summary>
        /// Opens a file by opening a new stream.
        /// </summary>
        /// <param name="uri"></param>
        /// <param name="fileMode"></param>
        public void Open(Uri uri, DataFileMode fileMode)
        {
            if (uri == null)
            {
                throw new ArgumentNullException("uri"); // TODO
            }

            this.uri = uri;
            this.fileMode = fileMode;

            Open();
        }
Example #23
0
        /// <summary>
        /// Opens a file identified by a URI for read or write.
        /// </summary>
        /// <param name="uri"></param>
        /// <param name="mode"></param>
        /// <param name="compression"></param>
        /// <param name="archival"></param>
        /// <returns></returns>
        public Stream Open(Uri uri, DataFileMode mode, DataFileCompression compression, DataFileArchival archival)
        {
            this.uri = uri;
            this.mode = mode;
            this.compression = compression;
            this.archival = archival;

            return Open();
        }
Example #24
0
        /// <summary>
        /// Constructs a file and opens a stream automatically.
        /// </summary>
        /// <param name="uri"></param>
        /// <param name="fileMode"></param>
        /// <param name="compression"></param>
        protected DataFileBase(Uri uri, DataFileMode fileMode)
        {
            InitializeMembers(new StreamingContext());

            this.uri = uri;
            this.fileMode = fileMode;
        }
Example #25
0
 public CsvFile(Uri uri, DataFileMode fileMode)
     : this(uri, fileMode, CompressionMethod.Automatic)
 {
     // Overload
 }
Example #26
0
        private void InitializeMembers(StreamingContext context)
        {
            this.baseStream = null;
            this.ownsBaseStream = false;
            this.streamFactoryType = null;

            this.fileMode = DataFileMode.Unknown;
            this.uri = null;
            this.generateIdentityColumn = false;

            this.blocks = new List<DataFileBlockBase>();
            this.blockCounter = -1;
        }
Example #27
0
        /// <summary>
        /// Opens a file by wrapping a stream.
        /// </summary>
        /// <param name="stream"></param>
        /// <param name="mode"></param>
        /// <param name="compression"></param>
        protected void OpenExternalStream(Stream stream, DataFileMode fileMode)
        {
            this.baseStream = stream;
            this.ownsBaseStream = false;

            this.fileMode = fileMode;
        }
Example #28
0
 public CsvFile(Uri uri, DataFileMode fileMode, CompressionMethod compression)
     : this(uri, fileMode, compression, Encoding.ASCII, CultureInfo.InvariantCulture)
 {
     // Overload
 }
Example #29
0
        /// <summary>
        /// Constructs a file and opens a stream automatically
        /// </summary>
        /// <param name="uri"></param>
        /// <param name="fileMode"></param>
        /// <param name="compression"></param>
        protected DataFileBase(Uri uri, DataFileMode fileMode, CompressionMethod compression)
        {
            InitializeMembers();

            this.uri = uri;
            this.fileMode = fileMode;
            this.compression = compression;
        }
Example #30
0
 protected TextDataFileBase(Uri uri, DataFileMode fileMode, Encoding encoding, CultureInfo culture)
     : base(uri, fileMode, encoding, culture)
 {
     InitializeMembers();
 }
Example #31
0
 protected TextDataFileBase(Stream stream, DataFileMode fileMode, Encoding encoding, CultureInfo culture)
     : base(stream, fileMode, encoding, culture)
 {
     InitializeMembers();
 }
Example #32
0
 protected TextDataFileBase(Uri uri, DataFileMode fileMode, Encoding encoding, CultureInfo culture)
     : base(uri, fileMode, encoding, culture)
 {
     InitializeMembers();
 }
Example #33
0
        /// <summary>
        /// Constructs a file object around an already open stream.
        /// </summary>
        /// <param name="stream"></param>
        /// <param name="fileMode"></param>
        protected DataFileBase(Stream stream, DataFileMode fileMode)
        {
            InitializeMembers(new StreamingContext());

            OpenExternalStream(stream, fileMode);
        }
Example #34
0
 protected TextDataFile(Uri uri, DataFileMode fileMode, CompressionMethod compression, Encoding encoding, CultureInfo culture)
     : base(uri, fileMode, compression, encoding, culture)
 {
     InitializeMembers();
 }
Example #35
0
        private void CopyMembers(DataFileBase old)
        {
            this.baseStream = null;
            this.ownsBaseStream = false;

            this.fileMode = old.fileMode;
            this.uri = old.uri;
            this.generateIdentityColumn = old.generateIdentityColumn;

            // Deep copy of blocks
            this.blocks = new List<DataFileBlockBase>();
            foreach (var b in old.blocks)
            {
                var nb = (DataFileBlockBase)b.Clone();
                this.blocks.Add((DataFileBlockBase)b.Clone());
            }

            this.blockCounter = -1;
        }
Example #36
0
 public CsvFile(Stream stream, DataFileMode fileMode)
     : this(stream, fileMode, CompressionMethod.None, Encoding.ASCII, CultureInfo.InvariantCulture)
 {
     // Overload
 }
Example #37
0
        private void InitializeMembers()
        {
            this.baseStream = null;
            this.ownsBaseStream = false;
            this.uncompressedStream = null;

            this.fileMode = DataFileMode.Unknown;
            this.compression = CompressionMethod.None;
            this.uri = null;

            this.blocks = new List<DataFileBlockBase>();
            this.blockCounter = -1;
        }
Example #38
0
        /// <summary>
        /// Constructs a file object around an already open stream.
        /// </summary>
        /// <param name="stream"></param>
        /// <param name="fileMode"></param>
        protected DataFileBase(Stream stream, DataFileMode fileMode)
        {
            InitializeMembers(new StreamingContext());

            OpenExternalStream(stream, fileMode);
        }
Example #39
0
 public DelimitedTextDataFile(Stream stream, DataFileMode fileMode)
     : this(stream, fileMode, Encoding.ASCII, CultureInfo.InvariantCulture)
 {
     // Overload
 }
Example #40
0
        /// <summary>
        /// Opens a file by wrapping a stream.
        /// </summary>
        /// <param name="stream"></param>
        /// <param name="mode"></param>
        /// <param name="compression"></param>
        public virtual void Open(Stream stream, DataFileMode fileMode)
        {
            EnsureNotOpen();

            this.baseStream = stream;
            this.ownsBaseStream = false;

            this.fileMode = fileMode;
        }
 public DelimitedTextDataFile(Uri uri, DataFileMode fileMode)
     : this(uri, fileMode, Encoding.ASCII, CultureInfo.InvariantCulture)
 {
     // Overload
 }
Example #42
0
        protected DataFileBase(Stream stream, DataFileMode fileMode, CompressionMethod compression)
        {
            InitializeMembers();

            this.baseStream = stream;
            this.fileMode = fileMode;
            this.compression = compression;
        }
 public DelimitedTextDataFile(Stream stream, DataFileMode fileMode)
     : this(stream, fileMode, Encoding.ASCII, CultureInfo.InvariantCulture)
 {
     // Overload
 }
Example #44
0
        protected void Open(DataFileMode fileMode, DataFileArchival archival)
        {
            EnsureNotOpen();

            if (baseStream == null)
            {
                // Open input stream
                // Check if the archival option is turned on and open archive
                // file if necessary by opening an IArchiveInputStream

                var sf = GetStreamFactory();
                sf.Uri = uri;
                sf.Mode = fileMode;
                sf.Archival = archival;
                // TODO: add authentication options here

                baseStream = sf.Open();
                ownsBaseStream = true;
            }
            else
            {
                // Do nothing
            }
        }
Example #45
0
        /// <summary>
        /// Opens a file identified by a URI for read or write.
        /// </summary>
        /// <param name="uri"></param>
        /// <param name="mode"></param>
        /// <returns></returns>
        /// <remarks>
        /// If not set explicitly through properties, compression and archival settings
        /// are figured out automatically from the file extension.
        /// </remarks>
        public Stream Open(Uri uri, DataFileMode mode)
        {
            this.uri = uri;
            this.mode = mode;

            return Open();
        }
Example #46
0
        /// <summary>
        /// Opens a file by wrapping an external file stream
        /// </summary>
        /// <param name="stream"></param>
        /// <param name="fileMode"></param>
        public void Open(Stream stream, DataFileMode fileMode)
        {
            if (stream == null)
            {
                throw new ArgumentNullException("stream");  // TODO
            }

            OpenExternalStream(stream, fileMode);
            Open();
        }
Example #47
0
 protected TextDataFileBase(Stream stream, DataFileMode fileMode, Encoding encoding, CultureInfo culture)
     : base(stream, fileMode, encoding, culture)
 {
     InitializeMembers();
 }
Example #48
0
        public override void Open(Stream stream, DataFileMode fileMode)
        {
            base.Open(stream, fileMode);

            Open();
        }