org.oreodata.standalone
Class FlatRecordInputStream
java.lang.Object
|
+--java.io.InputStream
|
+--java.io.FilterInputStream
|
+--java.io.DataInputStream
|
+--org.oreodata.standalone.FlatRecordInputStream
- All Implemented Interfaces:
- java.io.DataInput, java.io.ObjectInput, ValidatingRecordInput
- public class FlatRecordInputStream
- extends java.io.DataInputStream
- implements java.io.ObjectInput, ValidatingRecordInput
An implementation of the ObjectInput interface
for slurping Records off a stream in their
default flat-file format, which is not
the standard Java serialised object format.
Objects are ASCII serialised in a format like this:
_meta=reminder.1
unique_id=1
creation_date=Nov 17, 1999 8:03:15 AM
name=vitamin
...
The stream will be a complete clean rewrite of all live persistent objects followed
by some appended delete and add records of changes since the last complete rewrite.
The append section could contain obsolete records, deleted and added repeatedly.
- Author:
- Jonathan Revusky jon@revusky.com
Fields inherited from class java.io.FilterInputStream |
in |
Method Summary |
protected java.lang.String |
getTypeInfo()
Read the first line of the record data,
which tells us what type of record this is. |
java.lang.Object |
readObject()
Read the next record off the stream. |
Methods inherited from class java.io.DataInputStream |
read, read, readBoolean, readByte, readChar, readDouble, readFloat, readFully, readFully, readInt, readLine, readLong, readShort, readUnsignedByte, readUnsignedShort, readUTF, readUTF, skipBytes |
Methods inherited from class java.io.FilterInputStream |
available, close, mark, markSupported, read, reset, skip |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface java.io.ObjectInput |
available, close, read, read, read, skip |
Methods inherited from interface java.io.DataInput |
readBoolean, readByte, readChar, readDouble, readFloat, readFully, readFully, readInt, readLine, readLong, readShort, readUnsignedByte, readUnsignedShort, readUTF, skipBytes |
DELETION_MARKER
public static final java.lang.String DELETION_MARKER
- See Also:
- Constant Field Values
INSERTION_MARKER
public static final java.lang.String INSERTION_MARKER
- See Also:
- Constant Field Values
UPDATE_MARKER
public static final java.lang.String UPDATE_MARKER
- See Also:
- Constant Field Values
FlatRecordInputStream
public FlatRecordInputStream(java.io.InputStream is)
- Constructor, given stream
- Parameters:
is
- the underlying stream to read persistent data from.
FlatRecordInputStream
public FlatRecordInputStream(java.io.File file)
throws java.io.IOException
- a convenience constructor that takes a File argument.
- Parameters:
file
- File from which to read the persistent data.
- Throws:
java.io.IOException
readObject
public java.lang.Object readObject()
throws java.io.IOException,
java.lang.ClassNotFoundException
- Read the next record off the stream.
- Specified by:
readObject
in interface java.io.ObjectInput
- Returns:
- null if this is the end of the stream.
java.io.IOException
java.lang.ClassNotFoundException
getTypeInfo
protected java.lang.String getTypeInfo()
throws java.io.IOException
- Read the first line of the record data,
which tells us what type of record this is.
- Returns:
- record type e.g. "reminder.1
java.io.IOException