Servertec
Persistent Object Store
1.4.1 09/04/2005

stec.xpos
Class ObjectStoreRandomAccessStream

java.lang.Object
  extended by stec.xpos.ObjectStoreRandomAccessStream
All Implemented Interfaces:
java.io.DataInput, java.io.DataOutput

public class ObjectStoreRandomAccessStream
extends java.lang.Object
implements java.io.DataInput, java.io.DataOutput

Represents an random access stream to a persistent object store value.

Since:
1.3.0 10/19/2003
See Also:
getRandomAccessStream, getRandomAccessStream, getRandomAccessStream, OutputStream

Method Summary
 void close()
          Closes this random access stream.
 int getType()
          Returns the random access stream type.
 boolean isOpen()
          Returns whether this random access stream is still open.
 int length()
          Returns the size in bytes of the random access stream.
 int offset()
          Returns the current offset into the random access stream.
 int read()
          Reads a byte from the random access stream.
 int read(byte[] buffer)
          Reads into the specified byte array from the random access stream.
 int read(byte[] buffer, int offset, int length)
          Reads into the specified byte array from the random access stream.
 boolean readBoolean()
          Reads a boolean from the random access stream.
 byte readByte()
          Reads a byte from the random access stream.
 char readChar()
          Reads a char from the random access stream.
 double readDouble()
          Reads a double from the random access stream.
 float readFloat()
          Reads a float from the random access stream.
 void readFully(byte[] buffer)
          Reads into the specified byte array from the random access stream.
 void readFully(byte[] buffer, int offset, int length)
          Reads into the specified byte array from the random access stream.
 int readInt()
          Reads an int from the random access stream.
 java.lang.String readLine()
          Reads a line from the random access stream.
 long readLong()
          Reads a long from the random access stream.
 boolean readOnly()
          Returns whether the random access stream is read-only.
 short readShort()
          Reads a short from the random access stream.
 int readUnsignedByte()
          Reads an unsigned byte from the random access stream.
 int readUnsignedShort()
          Reads an unsigned short from the random access stream.
 java.lang.String readUTF()
          Reads a UTF-8 encoded string from the random access stream.
 int seek(int n)
          Sets the current offset into the random access stream to the specified offset.
 void setLength(int length)
          Sets the length of the random access stream.
 int skip(int n)
          Skips over the specified number of bytes.
 int skipBytes(int n)
          Skips over the specified number of bytes.
 void write(byte[] buffer)
          Writes the specified array of bytes to the random access stream.
 void write(byte[] buffer, int offset, int length)
          Writes the specified array of bytes to the random access stream.
 void write(int b)
          Writes the specified byte to the random access stream.
 void writeBoolean(boolean v)
          Writes the specified boolean into the random access stream.
 void writeByte(int v)
          Writes the specified byte into the random access stream.
 void writeBytes(java.lang.String s)
          Writes the specified string as an array of bytes into the random access stream.
 void writeChar(int v)
          Writes the specified char into the random access stream.
 void writeChars(java.lang.String s)
          Writes the specified string as an array of chars into the random access stream.
 void writeDouble(double v)
          Writes the specified double into the random access stream.
 void writeFloat(float v)
          Writes the specified float into the random access stream.
 void writeInt(int v)
          Writes the specified int into the random access stream.
 void writeLong(long v)
          Writes the specified long into the random access stream.
 void writeShort(int v)
          Writes the specified short into the random access stream.
 void writeUTF(java.lang.String s)
          Writes the specified string as UTF-8 encoded string into the random access stream.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

read

public final int read()
               throws java.io.IOException
Reads a byte from the random access stream.

Returns:
the byte read. -1 if at end of stream.
Throws:
java.io.IOException - if an I/O exception occurred.

read

public final int read(byte[] buffer,
                      int offset,
                      int length)
               throws java.io.IOException
Reads into the specified byte array from the random access stream.

Parameters:
buffer - the buffer to read into.
offset - the starting offset into the buffer.
length - the maximum number of bytes to read.
Returns:
the number of bytes read. -1 if at end of stream.
Throws:
java.io.IOException - if an I/O exception occurred.

read

public final int read(byte[] buffer)
               throws java.io.IOException
Reads into the specified byte array from the random access stream.

Parameters:
buffer - the buffer to read into.
Returns:
the number of bytes read. -1 if at end of stream.
Throws:
java.io.IOException - if an I/O exception occurred.

readFully

public final void readFully(byte[] buffer,
                            int offset,
                            int length)
                     throws java.io.IOException
Reads into the specified byte array from the random access stream.

Specified by:
readFully in interface java.io.DataInput
Parameters:
buffer - the buffer to read into.
offset - the starting offset into the buffer.
length - the maximum number of bytes to read.
Throws:
java.io.IOException - if an I/O exception occurred.

readFully

public final void readFully(byte[] buffer)
                     throws java.io.IOException
Reads into the specified byte array from the random access stream.

Specified by:
readFully in interface java.io.DataInput
Parameters:
buffer - the buffer to read into.
Throws:
java.io.IOException - if an I/O exception occurred.

skip

public final int skip(int n)
               throws java.io.IOException
Skips over the specified number of bytes.

Parameters:
n - the number of bytes to skip.
Returns:
the number of bytes skipped.
Throws:
java.io.IOException - if an I/O exception occurred.

skipBytes

public final int skipBytes(int n)
                    throws java.io.IOException
Skips over the specified number of bytes.

Specified by:
skipBytes in interface java.io.DataInput
Parameters:
n - the number of bytes to skip.
Returns:
the number of bytes skipped.
Throws:
java.io.IOException - if an I/O exception occurred.

getType

public final int getType()
                  throws java.io.IOException
Returns the random access stream type.

Returns:
random access stream type.
Throws:
java.io.IOException - if an I/O exception occurred.

length

public final int length()
                 throws java.io.IOException
Returns the size in bytes of the random access stream.

Returns:
the size in bytes of the random access stream.
Throws:
java.io.IOException - if an I/O exception occurred.

setLength

public final void setLength(int length)
                     throws java.io.IOException
Sets the length of the random access stream.

Parameters:
the - new length of the random access stream.
Throws:
java.io.IOException - if an I/O exception occurred.

offset

public final int offset()
                 throws java.io.IOException
Returns the current offset into the random access stream.

Returns:
the current offset into the random access stream.
Throws:
java.io.IOException - if an I/O exception occurred.

seek

public final int seek(int n)
               throws java.io.IOException
Sets the current offset into the random access stream to the specified offset.

Parameters:
n - the current offset into the random access stream to the specified offset.
Throws:
java.io.IOException - if an I/O exception occurred.

write

public final void write(int b)
                 throws java.io.IOException
Writes the specified byte to the random access stream.

Specified by:
write in interface java.io.DataOutput
Parameters:
b - the byte to write.
Throws:
java.io.IOException - if an I/O exception occurred.

write

public final void write(byte[] buffer)
                 throws java.io.IOException
Writes the specified array of bytes to the random access stream.

Specified by:
write in interface java.io.DataOutput
Parameters:
buffer - the array of bytes to write.
Throws:
java.io.IOException - if an I/O exception occurred.

write

public final void write(byte[] buffer,
                        int offset,
                        int length)
                 throws java.io.IOException
Writes the specified array of bytes to the random access stream.

Specified by:
write in interface java.io.DataOutput
Parameters:
buffer - the array of bytes to write.
offset - the starting offset into the buffer.
length - the number of bytes to write.
Throws:
java.io.IOException - if an I/O exception occurred.

readBoolean

public final boolean readBoolean()
                          throws java.io.IOException
Reads a boolean from the random access stream.

Specified by:
readBoolean in interface java.io.DataInput
Throws:
java.io.EOFException - if the end of stream was reached.
java.io.IOException - if an I/O exception occurred.

readByte

public final byte readByte()
                    throws java.io.IOException
Reads a byte from the random access stream.

Specified by:
readByte in interface java.io.DataInput
Throws:
java.io.EOFException - if the end of stream was reached.
java.io.IOException - if an I/O exception occurred.

readUnsignedByte

public final int readUnsignedByte()
                           throws java.io.IOException
Reads an unsigned byte from the random access stream.

Specified by:
readUnsignedByte in interface java.io.DataInput
Throws:
java.io.EOFException - if the end of stream was reached.
java.io.IOException - if an I/O exception occurred.

readShort

public final short readShort()
                      throws java.io.IOException
Reads a short from the random access stream.

Specified by:
readShort in interface java.io.DataInput
Throws:
java.io.EOFException - if the end of stream was reached.
java.io.IOException - if an I/O exception occurred.

readUnsignedShort

public final int readUnsignedShort()
                            throws java.io.IOException
Reads an unsigned short from the random access stream.

Specified by:
readUnsignedShort in interface java.io.DataInput
Throws:
java.io.EOFException - if the end of stream was reached.
java.io.IOException - if an I/O exception occurred.

readChar

public final char readChar()
                    throws java.io.IOException
Reads a char from the random access stream.

Specified by:
readChar in interface java.io.DataInput
Throws:
java.io.EOFException - if the end of stream was reached.
java.io.IOException - if an I/O exception occurred.

readInt

public final int readInt()
                  throws java.io.IOException
Reads an int from the random access stream.

Specified by:
readInt in interface java.io.DataInput
Throws:
java.io.EOFException - if the end of stream was reached.
java.io.IOException - if an I/O exception occurred.

readLong

public final long readLong()
                    throws java.io.IOException
Reads a long from the random access stream.

Specified by:
readLong in interface java.io.DataInput
Throws:
java.io.EOFException - if the end of stream was reached.
java.io.IOException - if an I/O exception occurred.

readFloat

public final float readFloat()
                      throws java.io.IOException
Reads a float from the random access stream.

Specified by:
readFloat in interface java.io.DataInput
Throws:
java.io.EOFException - if the end of stream was reached.
java.io.IOException - if an I/O exception occurred.

readDouble

public final double readDouble()
                        throws java.io.IOException
Reads a double from the random access stream.

Specified by:
readDouble in interface java.io.DataInput
Throws:
java.io.EOFException - if the end of stream was reached.
java.io.IOException - if an I/O exception occurred.

readLine

public final java.lang.String readLine()
                                throws java.io.IOException
Reads a line from the random access stream.

Specified by:
readLine in interface java.io.DataInput
Throws:
java.io.EOFException - if the end of stream was reached.
java.io.IOException - if an I/O exception occurred.

readUTF

public final java.lang.String readUTF()
                               throws java.io.IOException
Reads a UTF-8 encoded string from the random access stream.

Specified by:
readUTF in interface java.io.DataInput
Throws:
java.io.EOFException - if the end of stream was reached.
java.io.IOException - if an I/O exception occurred.

writeBoolean

public final void writeBoolean(boolean v)
                        throws java.io.IOException
Writes the specified boolean into the random access stream.

Specified by:
writeBoolean in interface java.io.DataOutput
Parameters:
v - the boolean to write.
Throws:
java.io.IOException - if an I/O exception occurred.

writeByte

public final void writeByte(int v)
                     throws java.io.IOException
Writes the specified byte into the random access stream.

Specified by:
writeByte in interface java.io.DataOutput
Parameters:
v - the byte to write.
Throws:
java.io.IOException - if an I/O exception occurred.

writeShort

public final void writeShort(int v)
                      throws java.io.IOException
Writes the specified short into the random access stream.

Specified by:
writeShort in interface java.io.DataOutput
Parameters:
v - the short to write.
Throws:
java.io.IOException - if an I/O exception occurred.

writeChar

public final void writeChar(int v)
                     throws java.io.IOException
Writes the specified char into the random access stream.

Specified by:
writeChar in interface java.io.DataOutput
Parameters:
v - the char to write.
Throws:
java.io.IOException - if an I/O exception occurred.

writeInt

public final void writeInt(int v)
                    throws java.io.IOException
Writes the specified int into the random access stream.

Specified by:
writeInt in interface java.io.DataOutput
Parameters:
v - the int to write.
Throws:
java.io.IOException - if an I/O exception occurred.

writeLong

public final void writeLong(long v)
                     throws java.io.IOException
Writes the specified long into the random access stream.

Specified by:
writeLong in interface java.io.DataOutput
Parameters:
v - the long to write.
Throws:
java.io.IOException - if an I/O exception occurred.

writeFloat

public final void writeFloat(float v)
                      throws java.io.IOException
Writes the specified float into the random access stream.

Specified by:
writeFloat in interface java.io.DataOutput
Parameters:
v - the float to write.
Throws:
java.io.IOException - if an I/O exception occurred.

writeDouble

public final void writeDouble(double v)
                       throws java.io.IOException
Writes the specified double into the random access stream.

Specified by:
writeDouble in interface java.io.DataOutput
Parameters:
v - the double to write.
Throws:
java.io.IOException - if an I/O exception occurred.

writeBytes

public final void writeBytes(java.lang.String s)
                      throws java.io.IOException
Writes the specified string as an array of bytes into the random access stream.

Specified by:
writeBytes in interface java.io.DataOutput
Parameters:
v - the string to write.
Throws:
java.io.IOException - if an I/O exception occurred.

writeChars

public final void writeChars(java.lang.String s)
                      throws java.io.IOException
Writes the specified string as an array of chars into the random access stream.

Specified by:
writeChars in interface java.io.DataOutput
Parameters:
v - the string to write.
Throws:
java.io.IOException - if an I/O exception occurred.

writeUTF

public final void writeUTF(java.lang.String s)
                    throws java.io.IOException
Writes the specified string as UTF-8 encoded string into the random access stream.

Specified by:
writeUTF in interface java.io.DataOutput
Parameters:
v - the string to write.
Throws:
java.io.IOException - if an I/O exception occurred.

isOpen

public final boolean isOpen()
                     throws java.io.IOException
Returns whether this random access stream is still open.

Returns:
whether this random access stream is still open.
Throws:
java.io.IOException - if an I/O exception occurred.

readOnly

public final boolean readOnly()
                       throws java.io.IOException
Returns whether the random access stream is read-only.

Returns:
whether the random access stream is read-only.
Throws:
java.io.IOException

close

public final void close()
                 throws java.io.IOException
Closes this random access stream.

Throws:
java.io.IOException - if this random access stream is closed or if an I/O exception occurs.

Servertec
Persistent Object Store
1.4.1 09/04/2005

Copyright © 2001-2005 Servertec. All rights reserved.