public final class Buffers
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static void |
copy(Buffer source,
Message dest)
Transform a Buffer into a Message.
|
static void |
copy(Message source,
Buffer dest)
Transform a Message into a Buffer.
|
static Buffer |
fromMessage(Message msg)
Transform a Message into a Buffer, using the default implementation
of Buffer interface.
|
static Buffer |
getDefaultBuffer()
Return a reference to the default Buffer implementation.
|
static BufferFormatter |
getDefaultFormatter()
Return a reference to the default BufferFormatter.
|
static void |
list(Buffer buf)
Print the contents of the specified Buffer to the Standard Output.
|
static void |
list(Buffer buf,
LogOutput out)
Print the contents of the specified Buffer to the specified instance
of LogOutput interface.
|
static void |
list(Buffer buf,
java.io.OutputStream out)
Print the contents of the specified Buffer to the specified OutputStream.
|
static void |
list(Buffer buf,
java.io.PrintWriter out)
Print the contents of the specified Buffer to the specified PrintWriter.
|
static java.lang.String |
listToString(Buffer buf)
Print the contents of the specified Buffer to a string.
|
static Buffer |
load(java.lang.String filename)
Restore the contents of a Buffer from the the specified file, using
the default BufferFormatter.
|
static boolean |
loadBoolean(Buffer from,
java.lang.String name)
Restore a simple value from a buffer.
|
static Buffer |
loadBuffer(Buffer from,
java.lang.String name)
Restore a buffer from another buffer.
|
static double |
loadDouble(Buffer from,
java.lang.String name)
Restore a simple value from a buffer.
|
static int |
loadInt(Buffer from,
java.lang.String name)
Restore a simple value from a buffer.
|
static java.lang.String |
loadString(Buffer from,
java.lang.String name)
Restore a simple value from a buffer.
|
static java.lang.String[] |
loadStringArray(Buffer from,
java.lang.String name)
Restore a string array from a buffer.
|
static void |
main(java.lang.String[] arg)
Method used for internal test.
|
static void |
mergeDuplicates(Buffer buf)
Merge nested buffers with the same names.
|
static void |
save(Buffer buffer,
java.lang.String filename)
Transform the specified Buffer into a String using the default
BufferFormatter and store this String in a file with the specified name.
|
static void |
save(Buffer into,
java.lang.String name,
boolean value)
Store a name-value pair in a buffer.
|
static void |
save(Buffer into,
java.lang.String name,
Buffer value)
Store a buffer in another buffer.
|
static void |
save(Buffer into,
java.lang.String name,
double value)
Store a name-value pair in a buffer.
|
static void |
save(Buffer into,
java.lang.String name,
int value)
Store a name-value pair in a buffer.
|
static void |
save(Buffer into,
java.lang.String name,
java.lang.String value)
Store a name-value pair in a buffer.
|
static void |
save(Buffer into,
java.lang.String name,
java.lang.String[] value)
Store a string array in a buffer.
|
static void |
save(Buffer into,
java.lang.String name,
java.lang.String[] value,
int count)
Store a string array in a buffer.
|
static void |
setDefaultBuffer(Buffer buffer)
Set the default Buffer implementation which will be used by some methods
in this class like fromMessage() or load().
|
static void |
setDefaultFormatter(BufferFormatter formatter)
Set the default BufferFormatter which will be used by some methods
in this class like save() or load().
|
static void |
sort(Buffer buf,
RowComparator comparator)
Sort all rows in a Buffer according to the specified RowComparator.
|
static void |
sortItems(Buffer buf,
ItemComparator comparator)
Sort all items in a Buffer according to the specified ItemComparator.
|
static Message |
toMessage(Buffer buffer)
Transform a Buffer into a Message.
|
public static Message toMessage(Buffer buffer) throws java.lang.Exception
buffer
- a buffer to transformjava.lang.Exception
public static Buffer fromMessage(Message msg) throws java.lang.Exception
msg
- a Message to transformjava.lang.Exception
public static void copy(Message source, Buffer dest) throws java.io.IOException
$name[:type][/status]then the type and/or status are mapped to the type and status of the corresponding Item.
source
- source Messagedest
- destination Bufferjava.io.IOException
public static void copy(Buffer source, Message dest) throws java.lang.Exception
$name[:type][/status]=value
source
- source Bufferdest
- destination Messagejava.lang.Exception
public static void setDefaultFormatter(BufferFormatter formatter)
formatter
- an instance of BufferFormatterpublic static void setDefaultBuffer(Buffer buffer)
buffer
- an instance of Bufferpublic static BufferFormatter getDefaultFormatter()
public static Buffer getDefaultBuffer()
public static void save(Buffer buffer, java.lang.String filename) throws java.io.IOException
java.io.IOException
public static Buffer load(java.lang.String filename) throws java.io.IOException, BufferFormatException
java.io.IOException
BufferFormatException
public static void list(Buffer buf) throws java.io.IOException
buf
- a buffer to listjava.io.IOException
public static void list(Buffer buf, java.io.OutputStream out) throws java.io.IOException
buf
- a buffer to listout
- an open OutputStreamjava.io.IOException
public static void list(Buffer buf, java.io.PrintWriter out) throws java.io.IOException
buf
- a buffer to listout
- an open PrintWriterjava.io.IOException
public static void list(Buffer buf, LogOutput out)
buf
- a buffer to listout
- the destination for listingpublic static java.lang.String listToString(Buffer buf)
buf
- a buffer to listpublic static void save(Buffer into, java.lang.String name, java.lang.String value)
into
- destination buffername
- the name of the item to storevalue
- simple value to storepublic static java.lang.String loadString(Buffer from, java.lang.String name)
from
- source buffername
- the name of the item to restorepublic static void save(Buffer into, java.lang.String name, int value)
into
- destination buffername
- the name of the item to storevalue
- simple value to storepublic static int loadInt(Buffer from, java.lang.String name)
from
- source buffername
- the name of the item to restorepublic static void save(Buffer into, java.lang.String name, double value)
into
- destination buffername
- the name of the item to storevalue
- simple value to storepublic static double loadDouble(Buffer from, java.lang.String name)
from
- source buffername
- the name of the item to restorepublic static void save(Buffer into, java.lang.String name, boolean value)
into
- destination buffername
- the name of the item to storepublic static boolean loadBoolean(Buffer from, java.lang.String name)
from
- source buffername
- the name of the item to restorepublic static void save(Buffer into, java.lang.String name, Buffer value)
into
- destination buffername
- the name of the compound item to storepublic static Buffer loadBuffer(Buffer from, java.lang.String name)
from
- source buffername
- the name of the buffer to restorepublic static void save(Buffer into, java.lang.String name, java.lang.String[] value)
into
- destination buffername
- the name of the array to storevalue
- the array to storepublic static void save(Buffer into, java.lang.String name, java.lang.String[] value, int count)
into
- the destination buffername
- the name of the array to storevalue
- the array to storecount
- the number array elements to storepublic static java.lang.String[] loadStringArray(Buffer from, java.lang.String name)
from
- the source buffername
- the name of the array to restorepublic static void sort(Buffer buf, RowComparator comparator) throws java.lang.Exception
buf
- a buffer to sortcomparator
- a RowComparator to use for comparison of itemsjava.lang.Exception
public static void sortItems(Buffer buf, ItemComparator comparator) throws java.lang.Exception
buf
- a buffer to sortcomparator
- an ItemComparator to use for comparison of itemsjava.lang.Exception
public static void mergeDuplicates(Buffer buf) throws FndException
buf
- a buffer to merge duplicates inFndException
public static void main(java.lang.String[] arg) throws java.lang.Exception
java.lang.Exception