org.norther.tammi.acorn.io
Class RecordWriter

java.lang.Object
  extended by org.norther.tammi.acorn.io.RecordWriter

public class RecordWriter
extends Object

A buffered writer for writing records.

Author:
Ilkka Priha

Constructor Summary
RecordWriter()
          Constructs a new writer.
RecordWriter(byte[] rec)
          Constructs a new writer with a record.
RecordWriter(int size)
          Constructs a new writer with size.
 
Method Summary
 DataOutputStream getDataOutputStream()
          Gets a data output stream.
 ObjectOutputStream getObjectOutputStream()
          Gets an object output stream.
 OutputStream getOutputStream()
          Gets an output stream.
 byte[] getRecord()
          Gets the record.
 void reset()
          Resets the buffer.
 void setRecord(byte[] rec)
          Sets the record.
 int size()
          Gets the buffer size.
 void writeObject(Object object)
          Writes an object.
 void writeTo(DataOutput data, int size)
          Writes the buffer to another stream.
 void writeUTF(String string)
          Writes an UTF string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RecordWriter

public RecordWriter()
Constructs a new writer.


RecordWriter

public RecordWriter(int size)
Constructs a new writer with size.

Parameters:
size - the size.

RecordWriter

public RecordWriter(byte[] rec)
Constructs a new writer with a record.

Parameters:
rec - the record.
Method Detail

getRecord

public byte[] getRecord()
Gets the record.

Returns:
the data record.

setRecord

public void setRecord(byte[] rec)
Sets the record.

Parameters:
rec - the data record.

getOutputStream

public OutputStream getOutputStream()
Gets an output stream.

Returns:
a record output stream.

getObjectOutputStream

public ObjectOutputStream getObjectOutputStream()
                                         throws IOException
Gets an object output stream.

Returns:
an object output stream.
Throws:
IOException - on errors.

getDataOutputStream

public DataOutputStream getDataOutputStream()
Gets a data output stream.

Returns:
a data output stream.

writeObject

public void writeObject(Object object)
                 throws IOException
Writes an object.

Parameters:
object - the object.
Throws:
IOException - on errors.

writeUTF

public void writeUTF(String string)
              throws IOException
Writes an UTF string.

Parameters:
string - the string.
Throws:
IOException - on errors.

size

public int size()
Gets the buffer size.

Returns:
the buffer size.

reset

public void reset()
Resets the buffer.


writeTo

public void writeTo(DataOutput data,
                    int size)
             throws IOException
Writes the buffer to another stream.

Parameters:
data - the output stream.
size - the size of the record.
Throws:
IOException - on I/O errors.
IllegalStateException - if size does not correspond to buffer size.


Copyright © 2004 The Norther Organization. All rights reserved.