|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object bibliothek.gui.dock.support.util.ApplicationResourceManager
public class ApplicationResourceManager
Manages a set of ApplicationResource
s, can load and store the
resources at any time.
The ApplicationResource
s are organized in a Map
. Each
resource is associated with a unique key. This key is used to determine, which
stream of bytes belongs to which resource. If data is loaded, the byte-streams
for missing resources will be stored in a buffer that is read as soon as
a missing resource is registered. Additional resources are ignored.
Note that there is no order how the resources are stored in the file.
Constructor Summary | |
---|---|
ApplicationResourceManager()
|
Method Summary | |
---|---|
void |
put(java.lang.String name,
ApplicationResource resource)
Stores a resource that might be read or written at any time. |
void |
readArray(byte[] array)
Reads the contents of this manager from an array of bytes. |
void |
readFile(java.io.File file)
Reads the contents of this manager from file . |
void |
readPreferences()
Reads the content of this manager from the Preferences that
represent the package of ApplicationResourceManager . |
void |
readStream(java.io.DataInputStream in)
Lets all ApplicationResource s read from in . |
void |
readXML(XElement element)
Reads the contents of this manager from a xml element. |
void |
remove(java.lang.String name)
Removes a resources that was earlier added to this manager. |
byte[] |
writeArray()
Writes the contents of this manager into an array of bytes. |
void |
writeFile(java.io.File file)
Writes the contents of this manager into file . |
void |
writePreferences()
Writes the contents of this manager into the Preferences which
represent the package of ApplicationResourceManager . |
void |
writeStream(java.io.DataOutputStream out)
Writes all currently known ApplicationResource s into
out . |
void |
writeXML(XElement element)
Writes the content of this manager in xml format. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ApplicationResourceManager()
Method Detail |
---|
public void put(java.lang.String name, ApplicationResource resource) throws java.io.IOException
name
, then resource
will immediately
be asked to read the stream.
name
- the unique identifier of the resourceresource
- the new resource
java.lang.NullPointerException
- if name
of resource
is null
java.io.IOException
- if the buffered stream can't be read. The resource
will be stored in this manager even if an exception occurspublic void remove(java.lang.String name)
name
- the name of the resource to removepublic void writeStream(java.io.DataOutputStream out) throws java.io.IOException
ApplicationResource
s into
out
.
out
- the stream to write into
java.io.IOException
- if the operation can't be completedpublic void readStream(java.io.DataInputStream in) throws java.io.IOException
ApplicationResource
s read from in
.
in
- the stream to read from
java.io.IOException
- if the operation can't be completedpublic void writeXML(XElement element)
element
- the element to write into, the attributes of this
element will not be changed.public void readXML(XElement element)
element
- the element to readpublic void writeFile(java.io.File file) throws java.io.IOException
file
.
file
- the file to write into
java.io.IOException
- if the operation can't be completedpublic void readFile(java.io.File file) throws java.io.IOException
file
.
file
- the file to read
java.io.IOException
- if the operation can't be completedpublic byte[] writeArray() throws java.io.IOException
java.io.IOException
- if the operation can't be completedpublic void readArray(byte[] array) throws java.io.IOException
array
- the content as stream of bytes
java.io.IOException
- if the operation can't be completedpublic void writePreferences() throws java.io.IOException
Preferences
which
represent the package of ApplicationResourceManager
.
java.io.IOException
- if the operation can't be completedpublic void readPreferences() throws java.io.IOException
Preferences
that
represent the package of ApplicationResourceManager
.
java.io.IOException
- if the operation can't be completed
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |