/** * Construct a new GZipFldField object and load a field file * from the specified filename. * * @throws IOException, InvalidFieldException, ApplicationException */ public GZipFldField(string filename) { Stream file = new FileStream(filename, FileMode.Open); Stream gzipStream = new GZipInputStream(file); field = new FldField(gzipStream); gzipStream.Close(); file.Close(); }
/** * Save the current field file. * * @require fieldView.Field != null */ private void Save(string filename) { Field field; string extension, fn; fn = filename.ToLower(); extension = Path.GetExtension(fn); if ((extension == ".fld" && fieldView.Field is FldField) || (extension == ".gat" && fieldView.Field is GatField) || (fn.EndsWith(".fld.gz") && fieldView.Field is GZipFldField)) { field = fieldView.Field; } else if (fn.EndsWith(".fld")) { field = new FldField(fieldView.Field); } else { field = new GZipFldField(fieldView.Field); } try { field.Save(filename); fieldView.Field = field; this.filename = filename; Update(); } catch (IOException e) { ShowError("Cannot save file:\n" + e.Message); } catch (SaveNotSupportedException e) { ShowError(e.Message); } }
/** * Construct an FldField object from another Field object. */ public GZipFldField(Field field) { this.field = new FldField(field); }