org.axonframework.common.io
Class BinaryEntryOutputStream

java.lang.Object
  extended by org.axonframework.common.io.BinaryEntryOutputStream

public class BinaryEntryOutputStream
extends Object

Wrapper around an output stream that can be used to write simple values, that can be read back in by the BinaryEntryInputStream. This output stream writes whitespace-separated entries to an output stream. That means that the entries (except for binary entries) may not contain whitespace themselves.

This class is meant for internal use, and should be used with care.

Since:
1.0
Author:
Allard Buijze

Constructor Summary
BinaryEntryOutputStream(OutputStream outputStream)
          Initialize a BinaryEntryOutputStream writing its entries to the given outputStream.
 
Method Summary
 void writeBytes(byte[] bytes)
          Writes the given bytes to the backing stream.
 void writeNumber(int value)
          Writes a numeric entry.
 void writeNumber(long value)
          Writes a numeric entry.
 void writeString(String value)
          Writes a String entry.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BinaryEntryOutputStream

public BinaryEntryOutputStream(OutputStream outputStream)
Initialize a BinaryEntryOutputStream writing its entries to the given outputStream.

Parameters:
outputStream - the output stream where entries are to be written to
Method Detail

writeNumber

public void writeNumber(long value)
                 throws IOException
Writes a numeric entry.

Parameters:
value - The value to write
Throws:
IOException - if an error occurs reading from the backing stream

writeNumber

public void writeNumber(int value)
                 throws IOException
Writes a numeric entry.

Parameters:
value - The value to write
Throws:
IOException - if an error occurs reading from the backing stream

writeString

public void writeString(String value)
                 throws IOException
Writes a String entry. The given value may not contain any whitespace characters. Use writeBytes(byte[]) to write such entries instead.

Parameters:
value - The String to write. Should not contain any whitespace characters.
Throws:
IOException - if an error occurs reading from the backing stream

writeBytes

public void writeBytes(byte[] bytes)
                throws IOException
Writes the given bytes to the backing stream. The entry is terminated with a newline character.

Parameters:
bytes - The bytes to write
Throws:
IOException - if an error occurs reading from the backing stream


Copyright © 2010-2012. All Rights Reserved.