/// <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();
        }
Exemple #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();
        }
        /// <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;
        }
        /// <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();
        }
Exemple #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;
        }
        protected FormattedDataFile(Stream stream, DataFileMode fileMode, CompressionMethod compression, Encoding encoding, CultureInfo culture)
            : base(stream, fileMode, compression)
        {
            InitializeMembers();

            this.encoding = encoding;
            this.culture = culture;
        }
        /// <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());
        }
        /// <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;
        }
Exemple #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();
        }
Exemple #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();
        }
Exemple #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;
        }
Exemple #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
            }
        }
Exemple #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;
        }
Exemple #21
0
 public DelimitedTextDataFile(Uri uri, DataFileMode fileMode)
     : this(uri, fileMode, Encoding.ASCII, CultureInfo.InvariantCulture)
 {
     // Overload
 }
Exemple #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();
        }
Exemple #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();
        }
Exemple #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;
        }
Exemple #25
0
 public CsvFile(Uri uri, DataFileMode fileMode)
     : this(uri, fileMode, CompressionMethod.Automatic)
 {
     // Overload
 }
Exemple #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;
        }
Exemple #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;
        }
Exemple #28
0
 public CsvFile(Uri uri, DataFileMode fileMode, CompressionMethod compression)
     : this(uri, fileMode, compression, Encoding.ASCII, CultureInfo.InvariantCulture)
 {
     // Overload
 }
Exemple #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;
        }
Exemple #30
0
 protected TextDataFileBase(Uri uri, DataFileMode fileMode, Encoding encoding, CultureInfo culture)
     : base(uri, fileMode, encoding, culture)
 {
     InitializeMembers();
 }
Exemple #31
0
 protected TextDataFileBase(Stream stream, DataFileMode fileMode, Encoding encoding, CultureInfo culture)
     : base(stream, fileMode, encoding, culture)
 {
     InitializeMembers();
 }
Exemple #32
0
 protected TextDataFileBase(Uri uri, DataFileMode fileMode, Encoding encoding, CultureInfo culture)
     : base(uri, fileMode, encoding, culture)
 {
     InitializeMembers();
 }
Exemple #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);
        }
Exemple #34
0
 protected TextDataFile(Uri uri, DataFileMode fileMode, CompressionMethod compression, Encoding encoding, CultureInfo culture)
     : base(uri, fileMode, compression, encoding, culture)
 {
     InitializeMembers();
 }
Exemple #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;
        }
Exemple #36
0
 public CsvFile(Stream stream, DataFileMode fileMode)
     : this(stream, fileMode, CompressionMethod.None, Encoding.ASCII, CultureInfo.InvariantCulture)
 {
     // Overload
 }
Exemple #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;
        }
Exemple #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);
        }
Exemple #39
0
 public DelimitedTextDataFile(Stream stream, DataFileMode fileMode)
     : this(stream, fileMode, Encoding.ASCII, CultureInfo.InvariantCulture)
 {
     // Overload
 }
Exemple #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
 }
Exemple #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
 }
        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
            }
        }
Exemple #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();
        }
Exemple #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();
        }
Exemple #47
0
 protected TextDataFileBase(Stream stream, DataFileMode fileMode, Encoding encoding, CultureInfo culture)
     : base(stream, fileMode, encoding, culture)
 {
     InitializeMembers();
 }
Exemple #48
0
        public override void Open(Stream stream, DataFileMode fileMode)
        {
            base.Open(stream, fileMode);

            Open();
        }