|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--venice.VeniceFileHandler
VeniceFileHandler is an class which is used to handle loading and saving of .venice-files which is the native storage format of Venice. .venice-files are Zipped files which include both the model in GXL format (model.gxl) and the visualization in visualization subsystems native format (model.visualization).
Do not use the same VeniceFileHandler instance for both loading and saving!
Example of using this class for saving a file in .venice-format:
VeniceFileHandler vfh = new VeniceFileHandler(); OutputStream gxlStream = vfh.getGXLOutputStream(); OutputStream visStream = vfh.getVisualizationOutputStream(); PrintWriter pw; pw = new PrintWriter(gxlStream); pw.println("This is the GXL FILE!"); pw.close(); pw = new PrintWriter(visStream); pw.println("This is the Visualization file!"); pw.close(); OutputStream os = new FileOutputStream("testfile.venice"); vfh.writeTo(os);
Example of using this class for loading a file in .venice-format:
InputStream is = new FileInputStream("testfile.venice"); vfh = new VeniceFileHandler(); vfh.readFrom(is); BufferedReader rdr; rdr = new BufferedReader (new InputStreamReader(vfh.getGXLInputStream())); System.out.println(rdr.readLine()); rdr.close(); rdr = new BufferedReader (new InputStreamReader(vfh.getVisualizationInputStream())); System.out.println(rdr.readLine()); rdr.close();
Field Summary | |
private static int |
BUFSIZE
size of buffer which is used when reading in contents of the archive |
private byte[] |
mGXLData
full contents of the GXL file as a byte array |
private java.io.ByteArrayOutputStream |
mGXLOutputStream
output stream which is returned to applications wanting to write |
private byte[] |
mVisualizationData
full contents of the visualization file as a byte array |
private java.io.ByteArrayOutputStream |
mVisualizationOutputStream
output stream which is returned to applications wanting to write |
Constructor Summary | |
VeniceFileHandler()
|
Method Summary | |
java.io.InputStream |
getGXLInputStream()
returns an InputStream which can be used to write the GXL file inside the venice file |
java.io.OutputStream |
getGXLOutputStream()
returns an OutputStream which can be used to read the GXL file embedded in the venice file. |
java.io.InputStream |
getVisualizationInputStream()
returns an InputStream which can be used to write the Visualization file inside the venice file |
java.io.OutputStream |
getVisualizationOutputStream()
returns an OutputStream which can be used to read the Visualization file embeded in the venice file. |
static void |
main(java.lang.String[] args)
Module test routines. |
private byte[] |
readEntry(java.util.zip.ZipInputStream inZipStream)
helper method to read one file from ZipInputStream to a byte buffer. |
void |
readFrom(java.io.InputStream ioStream)
reads the venice file from the InputStream to the handler. after this the 'substreams' can be requested using get*InputStream() methods. |
void |
writeTo(java.io.OutputStream ioStream)
Saves the GXL and visualization files associated with this VeniceFileHandler to a venice file (given as an OutputStream) |
Methods inherited from class java.lang.Object |
|
Field Detail |
private static final int BUFSIZE
private byte[] mGXLData
private byte[] mVisualizationData
private java.io.ByteArrayOutputStream mGXLOutputStream
private java.io.ByteArrayOutputStream mVisualizationOutputStream
Constructor Detail |
public VeniceFileHandler()
Method Detail |
public java.io.OutputStream getGXLOutputStream()
public java.io.OutputStream getVisualizationOutputStream()
public java.io.InputStream getGXLInputStream() throws java.io.IOException
public java.io.InputStream getVisualizationInputStream() throws java.io.IOException
public void readFrom(java.io.InputStream ioStream) throws java.io.IOException
private byte[] readEntry(java.util.zip.ZipInputStream inZipStream) throws java.io.IOException
public void writeTo(java.io.OutputStream ioStream) throws java.io.IOException
public static void main(java.lang.String[] args) throws java.lang.Exception
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |