be.SIRAPRISE.typeimplementations
Class ScalarValueBuffer

java.lang.Object
  extended by be.SIRAPRISE.typeimplementations.ValueBuffer
      extended by be.SIRAPRISE.typeimplementations.ScalarValueBuffer

public class ScalarValueBuffer
extends ValueBuffer

A ScalarValueBuffer is the class that can be used as a container for any sort of scalar value. It is a wrapper class around a java ByteBuffer.

Author:
Erwin Smout

Constructor Summary
ScalarValueBuffer(java.nio.ByteBuffer byteBuffer)
          Creates the value buffer and makes it store the scalar value contained in the ByteBuffer given.
 
Method Summary
 boolean equals(java.lang.Object obj)
          Tells whether or not this ScalarValueBuffer is equal to another object.
 java.nio.ByteBuffer getByteBuffer()
          Gets a read-only bytebuffer holding the encoded value
 int hashCode()
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ScalarValueBuffer

public ScalarValueBuffer(java.nio.ByteBuffer byteBuffer)
Creates the value buffer and makes it store the scalar value contained in the ByteBuffer given. The given ByteBuffer is rewound before the value held is copied into a local ByteBuffer. This copies all bytes from the given byteBuffer, starting at the first byte, and up to the given byteBuffer's current limit. Changes made later to byteBuffer will therefore not be reflected in this ScalarValueBuffer object.

Parameters:
byteBuffer - The ByteBuffer containing the (internal encoding of the) value.
Method Detail

equals

public final boolean equals(java.lang.Object obj)
Tells whether or not this ScalarValueBuffer is equal to another object. A ScalarValueBuffer can only be equal to another ScalarValueBuffer, and never to any other type of object. Two ScalarValueBuffer are equal if, and only if,

  1. Their ByteBuffers are of equal length, and

  2. All bytes in the two ByteBuffers' corresponding positions, are equal.

Overrides:
equals in class java.lang.Object
Parameters:
obj - The object to which this buffer is to be compared
Returns:
true if, and only if, this ScalarValueBuffer is equal to the given object

getByteBuffer

public final java.nio.ByteBuffer getByteBuffer()
Gets a read-only bytebuffer holding the encoded value

Returns:
A read-only bytebuffer holding the encoded value

hashCode

public final int hashCode()
Overrides:
hashCode in class java.lang.Object

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object