com.sleepycat.persist.impl
Class RecordInput

java.lang.Object
  extended by java.io.InputStream
      extended by com.sleepycat.util.FastInputStream
          extended by com.sleepycat.bind.tuple.TupleInput
              extended by com.sleepycat.persist.impl.RecordInput
All Implemented Interfaces:
EntityInput, java.io.Closeable

 class RecordInput
extends TupleInput
implements EntityInput

Implements EntityInput to read record key-data pairs. Extends TupleInput to implement the subset of TupleInput methods that are defined in the EntityInput interface.

Author:
Mark Hayes

Field Summary
 
Fields inherited from class com.sleepycat.util.FastInputStream
buf, len, mark, off
 
Constructor Summary
RecordInput(Catalog catalog, boolean rawAccess, DatabaseEntry priKeyEntry, int priKeyFormatId, byte[] buffer, int offset, int length)
          Creates a new input with a empty/null VisitedObjects set.
 
Method Summary
 Catalog getCatalog()
          Returns the Catalog associated with this input.
(package private)  KeyLocation getKeyLocation(Format fieldFormat)
          Called when copying secondary keys, for an input that is positioned on the secondary key field.
 boolean isRawAccess()
          Return whether this input is in raw mode, i.e., whether it is returning raw instances.
 int readArrayLength()
          Called by ObjectArrayFormat and PrimitiveArrayFormat to read the array length.
 int readEnumConstant(java.lang.String[] names)
          Called by EnumFormat to read and return index of the enum constant.
 java.lang.Object readKeyObject(Format format)
          Called for a primary key field or a composite key field with a reference type.
 java.lang.Object readObject()
          Called via Accessor to read all fields with reference types, except for the primary key field and composite key fields (see readKeyObject below).
 void registerPriKeyObject(java.lang.Object o)
          Called via Accessor.readSecKeyFields for a primary key field with a reference type.
 boolean setRawAccess(boolean rawAccessParam)
          Changes raw mode and returns the original mode, which is normally restored later.
 void skipField(Format declaredFormat)
          Called via PersistKeyCreator to skip fields prior to the secondary key field.
 
Methods inherited from class com.sleepycat.bind.tuple.TupleInput
getBigIntegerByteLength, getPackedIntByteLength, getStringByteLength, readBigInteger, readBoolean, readByte, readBytes, readBytes, readChar, readChars, readChars, readDouble, readFloat, readInt, readLong, readPackedInt, readShort, readSortedDouble, readSortedFloat, readString, readString, readString, readUnsignedByte, readUnsignedInt, readUnsignedShort
 
Methods inherited from class com.sleepycat.util.FastInputStream
available, getBufferBytes, getBufferLength, getBufferOffset, mark, markSupported, read, read, read, readFast, readFast, readFast, reset, skip, skipFast
 
Methods inherited from class java.io.InputStream
close
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.sleepycat.persist.impl.EntityInput
readBigInteger, readBoolean, readByte, readChar, readInt, readLong, readShort, readSortedDouble, readSortedFloat, readString
 

Constructor Detail

RecordInput

RecordInput(Catalog catalog,
            boolean rawAccess,
            DatabaseEntry priKeyEntry,
            int priKeyFormatId,
            byte[] buffer,
            int offset,
            int length)
Creates a new input with a empty/null VisitedObjects set.

Method Detail

getCatalog

public Catalog getCatalog()
Description copied from interface: EntityInput
Returns the Catalog associated with this input.

Specified by:
getCatalog in interface EntityInput
See Also:
EntityInput.getCatalog()

isRawAccess

public boolean isRawAccess()
Description copied from interface: EntityInput
Return whether this input is in raw mode, i.e., whether it is returning raw instances.

Specified by:
isRawAccess in interface EntityInput
See Also:
EntityInput.isRawAccess()

setRawAccess

public boolean setRawAccess(boolean rawAccessParam)
Description copied from interface: EntityInput
Changes raw mode and returns the original mode, which is normally restored later. For temporarily changing the mode during a conversion.

Specified by:
setRawAccess in interface EntityInput
See Also:
EntityInput.setRawAccess(boolean)

readObject

public java.lang.Object readObject()
Description copied from interface: EntityInput
Called via Accessor to read all fields with reference types, except for the primary key field and composite key fields (see readKeyObject below).

Specified by:
readObject in interface EntityInput
See Also:
EntityInput.readObject()

readKeyObject

public java.lang.Object readKeyObject(Format format)
Description copied from interface: EntityInput
Called for a primary key field or a composite key field with a reference type.

For such key fields, no formatId is present nor can the object already be present in the visited object set.

Specified by:
readKeyObject in interface EntityInput
See Also:
EntityInput.readKeyObject(com.sleepycat.persist.impl.Format)

getKeyLocation

KeyLocation getKeyLocation(Format fieldFormat)
Called when copying secondary keys, for an input that is positioned on the secondary key field. Handles references to previously occurring objects, returning a different RecordInput than this one if appropriate.


registerPriKeyObject

public void registerPriKeyObject(java.lang.Object o)
Description copied from interface: EntityInput
Called via Accessor.readSecKeyFields for a primary key field with a reference type. This method must be called before reading any other fields.

Specified by:
registerPriKeyObject in interface EntityInput
See Also:
EntityInput.registerPriKeyObject(java.lang.Object)

skipField

public void skipField(Format declaredFormat)
Description copied from interface: EntityInput
Called via PersistKeyCreator to skip fields prior to the secondary key field. Also called during class evolution so skip deleted fields.

Specified by:
skipField in interface EntityInput
See Also:
EntityInput.skipField(com.sleepycat.persist.impl.Format)

readArrayLength

public int readArrayLength()
Description copied from interface: EntityInput
Called by ObjectArrayFormat and PrimitiveArrayFormat to read the array length.

Specified by:
readArrayLength in interface EntityInput

readEnumConstant

public int readEnumConstant(java.lang.String[] names)
Description copied from interface: EntityInput
Called by EnumFormat to read and return index of the enum constant.

Specified by:
readEnumConstant in interface EntityInput


Copyright 2004,2008 Oracle. All rights reserved.