public class StateBuffer
extends java.lang.Object
Constructor and Description |
---|
StateBuffer(java.io.File stateBufferFile,
boolean isNewFile)
Creates a state buffer with the given file.
|
Modifier and Type | Method and Description |
---|---|
void |
addState(java.lang.String className,
java.lang.String tag,
byte[] data)
Adds state information for a given item, where the item
is described by its originating class, tag description, and
state data.
|
byte[] |
getStateData(java.lang.String className,
java.lang.String tag)
Retrieves a state item's data according to class name and tag
descriptor.
|
static void |
main(java.lang.String[] args)
Prints the contents of a state buffer file.
|
void |
reset()
Resets the state data to empty.
|
java.lang.String |
toString()
Converts all state data and meta-data to a String.
|
void |
write()
Writes the state data to disk.
|
void |
writeTo(java.io.OutputStream output)
Writes the state data to the given OutputStream.
|
public StateBuffer(java.io.File stateBufferFile, boolean isNewFile) throws java.io.IOException
stateBufferFile
- Output file to useisNewFile
- Should the file be treated as
as a new buffer file?java.io.IOException
public void addState(java.lang.String className, java.lang.String tag, byte[] data)
className
- Originating class nametag
- Tag description if state itemdata
- State datapublic void write() throws java.io.IOException
java.io.IOException
public void writeTo(java.io.OutputStream output) throws java.io.IOException
output
- Output stream for writing.java.io.IOException
public void reset()
public byte[] getStateData(java.lang.String className, java.lang.String tag)
className
- Originating class nametag
- Tag descriptorpublic java.lang.String toString()
toString
in class java.lang.Object
public static void main(java.lang.String[] args)
args
- State buffer file name