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.
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.