Joshua
open source statistical hierarchical phrase-based machine translation system
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends
joshua.util.io.BinaryOut Class Reference
Inheritance diagram for joshua.util.io.BinaryOut:
[legend]
Collaboration diagram for joshua.util.io.BinaryOut:
[legend]

List of all members.

Classes

enum  utf8CharRange

Public Member Functions

 BinaryOut (File file) throws FileNotFoundException, IOException
 BinaryOut (String filename) throws FileNotFoundException, IOException
 BinaryOut (OutputStream out, boolean writeObjects) throws IOException
void close () throws IOException
void flush () throws IOException
void write (int b) throws IOException
void write (byte[] b) throws IOException
void write (byte[] b, int off, int len) throws IOException
void writeObject (Object obj) throws IOException
void writeBoolean (boolean v) throws IOException
void writeByte (int v) throws IOException
void writeBytes (String s) throws IOException
void writeChar (int v) throws IOException
void writeChars (String s) throws IOException
void writeDouble (double v) throws IOException
void writeFloat (float v) throws IOException
void writeInt (int v) throws IOException
void writeLong (long v) throws IOException
void writeShort (int v) throws IOException
void writeUTF (String str) throws IOException

Public Attributes

final int BITS_PER_BYTE = 8
final int BOOLEAN_SIZE = 1
final int BYTE_SIZE = 1
final int CHAR_SIZE = 2
final int SHORT_SIZE = 2
final int FLOAT_SIZE = 4
final int INT_SIZE = 4
final int DOUBLE_SIZE = 8
final int LONG_SIZE = 8

Protected Member Functions

void prepareBuffer (int size) throws IOException
void writeBuffer () throws IOException

Private Member Functions

long utfBytesRequired (String str)
void writeUTF (String str, long bytesRequired, boolean forceLongHeader) throws IOException

Private Attributes

final OutputStream out
int bufferPosition
final byte[] buffer
final char[] charBuffer
final utf8CharRange[] charSizeBuffer
final boolean writeObjects

Static Private Attributes

static final Logger logger = Logger.getLogger(BinaryOut.class.getName())
static final int BUFFER_SIZE = 1024

Detailed Description

A BinaryOut writes data to an output stream in raw binary form. Each data type is converted to byte representation.

Unlike ObjectOutputStream, no extra Java meta-data is written to the stream.

Author:
Lane Schwartz
See also:
ObjectOutputStream
Externalizable

Constructor & Destructor Documentation

joshua.util.io.BinaryOut.BinaryOut ( File  file) throws FileNotFoundException, IOException
joshua.util.io.BinaryOut.BinaryOut ( String  filename) throws FileNotFoundException, IOException
joshua.util.io.BinaryOut.BinaryOut ( OutputStream  out,
boolean  writeObjects 
) throws IOException

Member Function Documentation

void joshua.util.io.BinaryOut.close ( ) throws IOException

Here is the call graph for this function:

void joshua.util.io.BinaryOut.flush ( ) throws IOException

Here is the call graph for this function:

Here is the caller graph for this function:

void joshua.util.io.BinaryOut.prepareBuffer ( int  size) throws IOException [protected]

Ensures that the buffer has at least enough space available to hold size additional bytes.

If necessary, the current contents of the buffer will be written to the underlying output stream.

Parameters:
size
Exceptions:
IOException

Here is the call graph for this function:

Here is the caller graph for this function:

long joshua.util.io.BinaryOut.utfBytesRequired ( String  str) [private]

Here is the caller graph for this function:

void joshua.util.io.BinaryOut.write ( int  b) throws IOException

Here is the call graph for this function:

Here is the caller graph for this function:

void joshua.util.io.BinaryOut.write ( byte[]  b) throws IOException

Here is the call graph for this function:

void joshua.util.io.BinaryOut.write ( byte[]  b,
int  off,
int  len 
) throws IOException

Here is the call graph for this function:

void joshua.util.io.BinaryOut.writeBoolean ( boolean  v) throws IOException

Here is the call graph for this function:

void joshua.util.io.BinaryOut.writeBuffer ( ) throws IOException [protected]

Here is the caller graph for this function:

void joshua.util.io.BinaryOut.writeByte ( int  v) throws IOException

Here is the call graph for this function:

void joshua.util.io.BinaryOut.writeBytes ( String  s) throws IOException

Here is the call graph for this function:

void joshua.util.io.BinaryOut.writeChar ( int  v) throws IOException

Here is the call graph for this function:

void joshua.util.io.BinaryOut.writeChars ( String  s) throws IOException

Here is the call graph for this function:

void joshua.util.io.BinaryOut.writeDouble ( double  v) throws IOException

Here is the call graph for this function:

void joshua.util.io.BinaryOut.writeFloat ( float  v) throws IOException

Here is the call graph for this function:

void joshua.util.io.BinaryOut.writeInt ( int  v) throws IOException

Here is the call graph for this function:

void joshua.util.io.BinaryOut.writeLong ( long  v) throws IOException

Here is the call graph for this function:

Here is the caller graph for this function:

void joshua.util.io.BinaryOut.writeObject ( Object  obj) throws IOException

Here is the call graph for this function:

void joshua.util.io.BinaryOut.writeShort ( int  v) throws IOException

Here is the call graph for this function:

Here is the caller graph for this function:

void joshua.util.io.BinaryOut.writeUTF ( String  str) throws IOException

Here is the call graph for this function:

Here is the caller graph for this function:

void joshua.util.io.BinaryOut.writeUTF ( String  str,
long  bytesRequired,
boolean  forceLongHeader 
) throws IOException [private]

Here is the call graph for this function:


Member Data Documentation

final byte [] joshua.util.io.BinaryOut.buffer [private]
final int joshua.util.io.BinaryOut.BUFFER_SIZE = 1024 [static, private]
final char [] joshua.util.io.BinaryOut.charBuffer [private]
final utf8CharRange [] joshua.util.io.BinaryOut.charSizeBuffer [private]
final Logger joshua.util.io.BinaryOut.logger = Logger.getLogger(BinaryOut.class.getName()) [static, private]
final OutputStream joshua.util.io.BinaryOut.out [private]
final boolean joshua.util.io.BinaryOut.writeObjects [private]