Exemplo n.º 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();
        }
Exemplo n.º 3
0
        public SqlServerNativeDataFile(Uri uri, DataFileMode fileMode)
            : base(uri, fileMode)
        {
            InitializeMembers();

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

            Open();
        }
Exemplo n.º 5
0
        public SqlServerNativeDataFile(Stream stream, DataFileMode fileMode)
            : base(stream, fileMode)
        {
            InitializeMembers();

            Open();
        }
Exemplo n.º 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;
        }
Exemplo n.º 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;
        }
Exemplo n.º 8
0
        public DelimitedTextDataFile(Stream stream, DataFileMode fileMode, Encoding encoding, CultureInfo culture)
            : base(stream, fileMode, encoding, culture)
        {
            InitializeMembers(new StreamingContext());

            Open();
        }
Exemplo n.º 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();
        }
Exemplo n.º 11
0
        protected FormattedDataFileBase(Stream stream, DataFileMode fileMode, Encoding encoding, CultureInfo culture)
            : base(stream, fileMode)
        {
            InitializeMembers(new StreamingContext());

            this.encoding = encoding;
            this.culture  = culture;
        }
Exemplo n.º 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;
        }
Exemplo n.º 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());
        }
Exemplo n.º 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;
        }
Exemplo n.º 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();
        }
Exemplo n.º 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();
        }
Exemplo n.º 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;
        }
Exemplo n.º 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;
        }
Exemplo n.º 19
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
            }
        }
Exemplo n.º 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;
        }
Exemplo n.º 21
0
 public DelimitedTextDataFile(Uri uri, DataFileMode fileMode)
     : this(uri, fileMode, Encoding.ASCII, CultureInfo.InvariantCulture)
 {
     // Overload
 }
Exemplo n.º 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();
        }
Exemplo n.º 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();
        }
Exemplo n.º 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;
        }
Exemplo n.º 25
0
 public CsvFile(Uri uri, DataFileMode fileMode)
     : this(uri, fileMode, CompressionMethod.Automatic)
 {
     // Overload
 }
Exemplo n.º 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;
        }
Exemplo n.º 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;
        }
Exemplo n.º 28
0
 public CsvFile(Uri uri, DataFileMode fileMode, CompressionMethod compression)
     : this(uri, fileMode, compression, Encoding.ASCII, CultureInfo.InvariantCulture)
 {
     // Overload
 }
Exemplo n.º 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;
        }
Exemplo n.º 30
0
 protected TextDataFileBase(Uri uri, DataFileMode fileMode, Encoding encoding, CultureInfo culture)
     : base(uri, fileMode, encoding, culture)
 {
     InitializeMembers();
 }
Exemplo n.º 31
0
 protected TextDataFileBase(Stream stream, DataFileMode fileMode, Encoding encoding, CultureInfo culture)
     : base(stream, fileMode, encoding, culture)
 {
     InitializeMembers();
 }
Exemplo n.º 32
0
 protected TextDataFileBase(Uri uri, DataFileMode fileMode, Encoding encoding, CultureInfo culture)
     : base(uri, fileMode, encoding, culture)
 {
     InitializeMembers();
 }
Exemplo n.º 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);
        }
Exemplo n.º 34
0
 protected TextDataFile(Uri uri, DataFileMode fileMode, CompressionMethod compression, Encoding encoding, CultureInfo culture)
     : base(uri, fileMode, compression, encoding, culture)
 {
     InitializeMembers();
 }
Exemplo n.º 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;
        }
Exemplo n.º 36
0
 public CsvFile(Stream stream, DataFileMode fileMode)
     : this(stream, fileMode, CompressionMethod.None, Encoding.ASCII, CultureInfo.InvariantCulture)
 {
     // Overload
 }
Exemplo n.º 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;
        }
Exemplo n.º 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);
        }
Exemplo n.º 39
0
 public DelimitedTextDataFile(Stream stream, DataFileMode fileMode)
     : this(stream, fileMode, Encoding.ASCII, CultureInfo.InvariantCulture)
 {
     // Overload
 }
Exemplo n.º 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;
        }
Exemplo n.º 41
0
 public DelimitedTextDataFile(Uri uri, DataFileMode fileMode)
     : this(uri, fileMode, Encoding.ASCII, CultureInfo.InvariantCulture)
 {
     // Overload
 }
Exemplo n.º 42
0
        protected DataFileBase(Stream stream, DataFileMode fileMode, CompressionMethod compression)
        {
            InitializeMembers();

            this.baseStream = stream;
            this.fileMode = fileMode;
            this.compression = compression;
        }
Exemplo n.º 43
0
 public DelimitedTextDataFile(Stream stream, DataFileMode fileMode)
     : this(stream, fileMode, Encoding.ASCII, CultureInfo.InvariantCulture)
 {
     // Overload
 }
Exemplo n.º 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
            }
        }
Exemplo n.º 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();
        }
Exemplo n.º 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();
        }
Exemplo n.º 47
0
 protected TextDataFileBase(Stream stream, DataFileMode fileMode, Encoding encoding, CultureInfo culture)
     : base(stream, fileMode, encoding, culture)
 {
     InitializeMembers();
 }
Exemplo n.º 48
0
        public override void Open(Stream stream, DataFileMode fileMode)
        {
            base.Open(stream, fileMode);

            Open();
        }