/// <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; }
public FileFormatDescription GetFileFormatDescription(Uri uri, out string filename, out string extension, out DataFileCompression compression) { GetExtensionWithoutCompression(uri, out filename, out extension, out compression); // FInd file format with the appropriate extensions FileFormatDescription format = null; foreach (var f in GetFileFormatDescriptions()) { if (StringComparer.InvariantCultureIgnoreCase.Compare(extension, f.Value.DefaultExtension) == 0) { format = f.Value; break; } } return(format); }
/// <summary> /// Returns the file extension by stripping of the extension of the /// compressed file, if any. /// </summary> protected void GetExtensionWithoutCompression(Uri uri, out string filename, out string extension, out DataFileCompression compressionMethod) { var path = Util.UriConverter.ToFilePath(uri); // This isn't always a file path, so it's the safest to do now extension = Path.GetExtension(path); if (Jhu.Graywulf.IO.Constants.CompressionExtensions.ContainsKey(extension)) { filename = Path.GetFileNameWithoutExtension(path); extension = Path.GetExtension(path); compressionMethod = Jhu.Graywulf.IO.Constants.CompressionExtensions[extension]; } else { filename = Path.GetFileName(path); extension = Path.GetExtension(path); compressionMethod = DataFileCompression.None; } }
/// <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(); }
public FileFormatDescription GetFileFormatDescription(Uri uri, out string filename, out string extension, out DataFileCompression compression) { GetExtensionWithoutCompression(uri, out filename, out extension, out compression); // FInd file format with the appropriate extensions FileFormatDescription format = null; foreach (var f in GetFileFormatDescriptions()) { if (StringComparer.InvariantCultureIgnoreCase.Compare(extension, f.Value.DefaultExtension) == 0) { format = f.Value; break; } } return format; }