net.sf.farrago.runtime
Class FennelTupleWriter

java.lang.Object
  extended by net.sf.farrago.runtime.FennelTupleWriter

public abstract class FennelTupleWriter
extends Object

FennelTupleWriter defines an interface for marshalling tuples to be sent to Fennel. Implementations are responsible for marshalling specific tuple formats.

Version:
$Id: //open/dev/farrago/src/net/sf/farrago/runtime/FennelTupleWriter.java#19 $
Author:
John V. Sichi

Field Summary
private static long MAGIC_NUMBER
          Matches fennel/tuple/TupleAccessor.cpp.
private static FennelTupleAccessor tupleAligner
          Singleton helper for aligning tuple buffers correctly.
 
Constructor Summary
FennelTupleWriter()
           
 
Method Summary
 boolean marshalTuple(ByteBuffer byteBuffer, Object object)
          Marshals one tuple if it can fit.
protected abstract  void marshalTupleOrThrow(ByteBuffer sliceBuffer, Object object)
          Marshals one tuple if it can fit; otherwise, throws either BufferOverflowException or IndexOutOfBoundsException (depending on whether absolute or relative puts are used).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MAGIC_NUMBER

private static long MAGIC_NUMBER
Matches fennel/tuple/TupleAccessor.cpp.


tupleAligner

private static FennelTupleAccessor tupleAligner
Singleton helper for aligning tuple buffers correctly.

Constructor Detail

FennelTupleWriter

public FennelTupleWriter()
Method Detail

marshalTupleOrThrow

protected abstract void marshalTupleOrThrow(ByteBuffer sliceBuffer,
                                            Object object)
Marshals one tuple if it can fit; otherwise, throws either BufferOverflowException or IndexOutOfBoundsException (depending on whether absolute or relative puts are used).

Parameters:
sliceBuffer - buffer to be filled with marshalled tuple data; on entry, the buffer position is 0; on return, the buffer position should be the unaligned end of the tuple
object - subclass-specific object to be marshalled
Throws:
BufferOverflowException - see above
IndexOutOfBoundsException - see above

marshalTuple

public boolean marshalTuple(ByteBuffer byteBuffer,
                            Object object)
Marshals one tuple if it can fit.

Parameters:
byteBuffer - buffer to be filled with marshalled tuple data, starting at current buffer position; on return, the buffer position should be the unaligned end of the tuple
object - subclass-specific object to be marshalled
Returns:
whether the marshalled tuple fit in the available buffer space