Saving and reading
The manager provides facilities to save its contents to a file. The resulting file is an ASCII or binary file in the .ivl format that contains information about the layers and the graphic objects.
The saving methods are as follows:
void write(OutputStream stream, boolean binary) throws IOException
void write(String filename) throws IOException
void write(String filename, boolean binary) throws IOException
You can save data in either an ASCII or a binary file, the binary format being more compact and faster to read than the ASCII format.
The loading methods are as follows:
void read(InputStream stream) throws IOException, IlvReadFileException
void read(String filename) throws IOException, IlvReadFileException
void read(URL url) throws IOException, IlvReadFileException
The read methods may throw an exception in the following situations:
The file is not an
.ivl file.
The
.ivl format is not correct.
A graphic class cannot be found.
The read methods detect automatically whether the .ivl file is an ASCII or a binary file.
You can save/read the information about your own graphic objects by providing the appropriate methods when creating your own graphic object class. For more information, see
Input/output operations and also
Saving and loading the object description.
Important The recommended way to serialize any IlvManager object is through IVL serialization and not Java™ serialization. Serialization cannot work for managers that contain graphic objects such as IlvIcon or some other classes, since these classes manage internally Java SE objects that are not serializable.
Copyright © 2018, Rogue Wave Software, Inc. All Rights Reserved.