com.neeve.sto
Class StoStringField

java.lang.Object
  extended by com.neeve.util.UtlListElement
      extended by com.neeve.sto.StoField
          extended by com.neeve.sto.StoVariableLengthField<String>
              extended by com.neeve.sto.StoStringField
All Implemented Interfaces:
Cloneable

public class StoStringField
extends StoVariableLengthField<String>

An STO field that holds a string value.

Threading:
STO fields are not safe for concurrent access by multiple threads.

Nested Class Summary
 
Nested classes/interfaces inherited from class com.neeve.sto.StoField
StoField.Type
 
Field Summary
 
Fields inherited from class com.neeve.util.UtlListElement
count, head, next, prev
 
Method Summary
static StoStringField create(ByteBuffer buffer, int bufferOffset)
          Create an STO string field from its serialized form.
static StoStringField create(String name)
          Create an STO string field.
static String get(ByteBuffer buffer, int offset)
          Deserialize a string value.
static int getSerializedLength(ByteBuffer buffer, int offset)
          Get the length of a serialized string value.
static int getSerializedLength(String val)
          Get the serialized length of a string.
static boolean isNull(ByteBuffer buffer, int offset)
          Check if a serialized string is null.
static int put(ByteBuffer buffer, int offset, String val)
          Serialize a string value.
 
Methods inherited from class com.neeve.sto.StoVariableLengthField
getValue, isVariableLength, reset, setValue
 
Methods inherited from class com.neeve.sto.StoField
changeBackingBuffer, clearBackingBuffer, clone, contentsEquals, getBackingBuffer, getHeader, getLength, getName, getSerializedLength, getType, getVersion, isNamed, setBackingBuffer, shiftForHeader, sync, toString
 
Methods inherited from class com.neeve.util.UtlListElement
count, insertAfter, insertBefore, isLinked, next, previous, unlink, wipe
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

create

public static StoStringField create(String name)
Create an STO string field.

Parameters:
name - The name of the field. A value of null will cause an unnamed field to be created.

create

public static StoStringField create(ByteBuffer buffer,
                                    int bufferOffset)
Create an STO string field from its serialized form.

Parameters:
buffer - The buffer containing the serialized field.
bufferOffset - The offset into the buffer where the serialized form of the field begins.

getSerializedLength

public static int getSerializedLength(ByteBuffer buffer,
                                      int offset)
Get the length of a serialized string value.

Parameters:
buffer - The buffer containing the serialized value.
offset - The offset into the buffer where the value is serialized.

This method leaves the buffer markers intact.


getSerializedLength

public static int getSerializedLength(String val)
Get the serialized length of a string.

Parameters:
val - The string whose serialized length is to be returned.

put

public static int put(ByteBuffer buffer,
                      int offset,
                      String val)
Serialize a string value.

Parameters:
buffer - The buffer in which to serialize the value.
offset - The offset into the buffer at which point to serialize the value.
Returns:
Returns the serialized length

This method leaves the buffer markers intact.


isNull

public static boolean isNull(ByteBuffer buffer,
                             int offset)
Check if a serialized string is null.

Parameters:
buffer - The buffer in which the string is serialized.
offset - The offset into the buffer where the string is serialized

This method leaves the buffer markers intact.


get

public static String get(ByteBuffer buffer,
                         int offset)
Deserialize a string value.

Parameters:
buffer - The buffer from which to deserialize the value.
offset - The offset into the buffer from which to deserialize the value.

This method leaves the buffer markers intact.



Copyright © 2015 Neeve Research, LLC. All Rights Reserved.