org.sandev.basics.nodecommon
Interface BinSerializer

All Superinterfaces:
Serializer

public interface BinSerializer
extends Serializer

Binary Serializer. Used for non-character serialization. See the superinterface for details.


Method Summary
 boolean isArray(java.io.ObjectInputStream in)
          Destructively tests the stream to see if it contains an array or a single SandMessage.
 SandMessage read(java.io.ObjectInputStream in)
          Read the specified stream for a SandMessage.
 SandMessage[] readArray(java.io.ObjectInputStream in)
          Reads the specified stream for a SandMessage[].
 void write(SandMessage msg, java.io.ObjectOutputStream out)
          Write the specified SandMessage to the output stream.
 void writeArray(SandMessage[] msgArray, java.io.ObjectOutputStream out)
          Write the specified SandMessage[] to the output stream.
 

Method Detail

write

void write(SandMessage msg,
           java.io.ObjectOutputStream out)
           throws java.io.IOException
Write the specified SandMessage to the output stream. If the msg is null, the results are undefined. If anything goes wrong an IOException is thrown. The implementation calls through to the corresponding static method to ensure reentrancy.

Throws:
java.io.IOException

read

SandMessage read(java.io.ObjectInputStream in)
                 throws java.io.IOException
Read the specified stream for a SandMessage. If no SandMessage was found, this method returns null. If an array is found, or if any other problem occurs, an IOException is thrown. The implementation calls through to the corresponding static method to ensure reentrancy.

Throws:
java.io.IOException

writeArray

void writeArray(SandMessage[] msgArray,
                java.io.ObjectOutputStream out)
                throws java.io.IOException
Write the specified SandMessage[] to the output stream. This method assumes that msgArray is not null. If the array is empty, then an empty array is written so it can be read back as empty. If anything goes wrong, an IOException is thrown. The implementation calls through to the corresponding static method to ensure reentrancy.

Throws:
java.io.IOException

readArray

SandMessage[] readArray(java.io.ObjectInputStream in)
                        throws java.io.IOException
Reads the specified stream for a SandMessage[]. If no array was found, this method returns null. If a single message is found, or if any other problem occurs, an IOException is thrown.

Throws:
java.io.IOException

isArray

boolean isArray(java.io.ObjectInputStream in)
                throws java.io.IOException
Destructively tests the stream to see if it contains an array or a single SandMessage. The stream must be reset after calling this method since the first part of it will have been read to determine the result.

Throws:
java.io.IOException