|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectbibliothek.gui.dock.support.util.ApplicationResourceManager
public class ApplicationResourceManager
Manages a set of ApplicationResources, can load and store the
resources at any time.
The ApplicationResources 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(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(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(DataInputStream in)
Lets all ApplicationResources read from in. |
void |
readXML(XElement element)
Reads the contents of this manager from a xml element. |
void |
remove(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(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(DataOutputStream out)
Writes all currently known ApplicationResources 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(String name,
ApplicationResource resource)
throws IOException
name, then resource will immediately
be asked to read the stream.
name - the unique identifier of the resourceresource - the new resource
NullPointerException - if name of resource
is null
IOException - if the buffered stream can't be read. The resource
will be stored in this manager even if an exception occurspublic void remove(String name)
name - the name of the resource to remove
public void writeStream(DataOutputStream out)
throws IOException
ApplicationResources into
out.
out - the stream to write into
IOException - if the operation can't be completed
public void readStream(DataInputStream in)
throws IOException
ApplicationResources read from in.
in - the stream to read from
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 read
public void writeFile(File file)
throws IOException
file.
file - the file to write into
IOException - if the operation can't be completed
public void readFile(File file)
throws IOException
file.
file - the file to read
IOException - if the operation can't be completed
public byte[] writeArray()
throws IOException
IOException - if the operation can't be completed
public void readArray(byte[] array)
throws IOException
array - the content as stream of bytes
IOException - if the operation can't be completed
public void writePreferences()
throws IOException
Preferences which
represent the package of ApplicationResourceManager.
IOException - if the operation can't be completed
public void readPreferences()
throws IOException
Preferences that
represent the package of ApplicationResourceManager.
IOException - if the operation can't be completed
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||