com.latencybusters.lbm.sdm
Class LBMSDMFieldString

java.lang.Object
  extended by com.latencybusters.lbm.sdm.LBMSDM
      extended by com.latencybusters.lbm.sdm.LBMSDMField
          extended by com.latencybusters.lbm.sdm.LBMSDMFieldString
All Implemented Interfaces:
java.lang.Cloneable
Direct Known Subclasses:
LBMSDMArrayString

public class LBMSDMFieldString
extends LBMSDMField
implements java.lang.Cloneable

Implements an SDM Field of type String


Field Summary
protected  java.lang.String internalValue
          The internal data storage for this field
 
Fields inherited from class com.latencybusters.lbm.sdm.LBMSDMField
elements, MAX_FIELD_NAME_LENGTH, name, type, TYPE_ARRAY_BLOB, TYPE_ARRAY_BOOLEAN, TYPE_ARRAY_DECIMAL, TYPE_ARRAY_DOUBLE, TYPE_ARRAY_FLOAT, TYPE_ARRAY_INT16, TYPE_ARRAY_INT32, TYPE_ARRAY_INT64, TYPE_ARRAY_INT8, TYPE_ARRAY_MESSAGE, TYPE_ARRAY_STRING, TYPE_ARRAY_TIMESTAMP, TYPE_ARRAY_UINT16, TYPE_ARRAY_UINT32, TYPE_ARRAY_UINT64, TYPE_ARRAY_UINT8, TYPE_ARRAY_UNICODE, TYPE_BLOB, TYPE_BOOLEAN, TYPE_DECIMAL, TYPE_DOUBLE, TYPE_FLOAT, TYPE_INT16, TYPE_INT32, TYPE_INT64, TYPE_INT8, TYPE_INVALID, TYPE_MESSAGE, TYPE_STRING, TYPE_TIMESTAMP, TYPE_UINT16, TYPE_UINT32, TYPE_UINT64, TYPE_UINT8, TYPE_UNICODE
 
Fields inherited from class com.latencybusters.lbm.sdm.LBMSDM
DEBUG_BASIC, debug_level, DEBUG_VERBOSE_PARSING
 
Constructor Summary
protected LBMSDMFieldString(short type, java.lang.String name)
          Constructor for array subclasses
  LBMSDMFieldString(java.lang.String name)
          Constructor for an empty string field.
  LBMSDMFieldString(java.lang.String name, java.lang.String v)
          Constructor for a string field with a known string
 
Method Summary
 LBMSDMFieldString clone()
          Get a copy of this object
static int format_long(byte[] buf, int offset, java.lang.String arbstr)
          Format a long string (greater than 255 characters) The formatted message will use a 4 byte length field to describe the string size
static int format_short(byte[] buf, int offset, java.lang.String arbstr)
          Format a short string (less than 255 characters) The formatted message will use a 1 byte length field to describe the string size
 int format(byte[] buf, int offset)
          Format the string as a long string The formatted message will use a 4 byte length field to describe the string size
protected static int format(byte[] buf, int offset, java.lang.String v, int len_size)
          Format a raw string in to a byte buffer specifying the size of the length field.
 int get_base_len()
          Get the length of formatted field This is used by the respective array class
 int get_len()
          Get the length of formatted field
 java.lang.String get()
          Get the raw string field
 int parse_name(byte[] buf, int offset)
          Parse a byte buffer and store the value as the name which is considered a short string
 int parse(byte[] buf, int offset)
          Parse a byte buffer and store the value as the string value which is considered a long string
 void set(java.lang.String v)
          Set the raw string.
 java.lang.String toDbgString()
          Get a string useful for debugging
 java.lang.String toString()
          Get the string
 
Methods inherited from class com.latencybusters.lbm.sdm.LBMSDMField
add_element, append, format_name, format_type, get_name, getType, getType, getTypeString, internalString, isNull, length, name_len, remove, sameBaseType, sameType, set_name, set, setNull, type_len
 
Methods inherited from class com.latencybusters.lbm.sdm.LBMSDM
log, set_debug_level
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

internalValue

protected java.lang.String internalValue
The internal data storage for this field

Constructor Detail

LBMSDMFieldString

public LBMSDMFieldString(java.lang.String name)
Constructor for an empty string field.

Parameters:
name - The field name

LBMSDMFieldString

public LBMSDMFieldString(java.lang.String name,
                         java.lang.String v)
Constructor for a string field with a known string

Parameters:
name - The field name
v - The string to be used as the field value

LBMSDMFieldString

protected LBMSDMFieldString(short type,
                            java.lang.String name)
Constructor for array subclasses

Parameters:
type - The field type to be created
name - The name of the field to be created
Method Detail

get

public java.lang.String get()
Get the raw string field

Returns:
The String

get_len

public int get_len()
Get the length of formatted field

Overrides:
get_len in class LBMSDMField
Returns:
The number of bytes a formatted String will use

get_base_len

public final int get_base_len()
Get the length of formatted field This is used by the respective array class

Returns:
The number of bytes a formatted String will use

set

public void set(java.lang.String v)
Set the raw string.

Parameters:
v - The LBMSDMRawBlob object to be set - it will be copied

toDbgString

public java.lang.String toDbgString()
Get a string useful for debugging

Overrides:
toDbgString in class LBMSDMField
Returns:
A string representation of this object

format

protected static int format(byte[] buf,
                            int offset,
                            java.lang.String v,
                            int len_size)
                     throws LBMSDMException
Format a raw string in to a byte buffer specifying the size of the length field. This is because strings can be limited to 255 bytes for names. String fields can be longer than 255 characters.

Parameters:
buf - The byte buffer to have the string formatted in
offset - The offset to begin formatting in the buffer
v - The string to be formatted
len_size - This specifies the size of the length field to be formatted and should be 1 or 4
Returns:
The updated offset after formatting (points to an unused offset)
Throws:
LBMSDMException - when an unexpected error occurs within LBMSDM

format_short

public static int format_short(byte[] buf,
                               int offset,
                               java.lang.String arbstr)
                        throws LBMSDMException
Format a short string (less than 255 characters) The formatted message will use a 1 byte length field to describe the string size

Parameters:
buf - The byte buffer to have the string formatted in
offset - The offset to begin formatting in the buffer
arbstr - The string to be formatted
Returns:
The updated offset after formatting (points to an unused offset)
Throws:
LBMSDMNameTooLongException - if the string exceeds 255 characters
LBMSDMException - when an unexpected error occurs within LBMSDM

format_long

public static int format_long(byte[] buf,
                              int offset,
                              java.lang.String arbstr)
                       throws LBMSDMException
Format a long string (greater than 255 characters) The formatted message will use a 4 byte length field to describe the string size

Parameters:
buf - The byte buffer to have the string formatted in
offset - The offset to begin formatting in the buffer
arbstr - The string to be formatted
Returns:
The updated offset after formatting (points to an unused offset)
Throws:
LBMSDMException - when an unexpected error occurs within LBMSDM

format

public int format(byte[] buf,
                  int offset)
           throws LBMSDMException
Format the string as a long string The formatted message will use a 4 byte length field to describe the string size

Overrides:
format in class LBMSDMField
Parameters:
buf - The byte buffer to have the string formatted in
offset - The offset to begin formatting in the buffer
Returns:
The updated offset after formatting (points to an unused offset)
Throws:
LBMSDMException - when an unexpected error occurs within LBMSDM

toString

public java.lang.String toString()
Get the string

Overrides:
toString in class java.lang.Object
Returns:
The String
Throws:
LBMSDMException - when an unexpected error occurs within LBMSDM

parse_name

public int parse_name(byte[] buf,
                      int offset)
               throws LBMSDMException
Parse a byte buffer and store the value as the name which is considered a short string

Parameters:
buf - The byte buffer to be parsed for the name
offset - The offset to begin parsing the buffer
Returns:
The next offset to be parsed
Throws:
LBMSDMException - when an unexpected error occurs within LBMSDM

parse

public int parse(byte[] buf,
                 int offset)
          throws LBMSDMException
Parse a byte buffer and store the value as the string value which is considered a long string

Overrides:
parse in class LBMSDMField
Parameters:
buf - The byte buffer to be parsed for the string value
offset - The offset to begin parsing the buffer
Returns:
The next offset to be parsed
Throws:
LBMSDMException - when an unexpected error occurs within LBMSDM

clone

public LBMSDMFieldString clone()
                        throws java.lang.CloneNotSupportedException
Get a copy of this object

Overrides:
clone in class LBMSDMField
Returns:
A new object with a copy
Throws:
java.lang.CloneNotSupportedException


All of the documentation and software included in this and any other Informatica Inc "Ultra Messaging" Release is Copyright (C) 2004-2014, Informatica Corporation. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted only as covered by the terms of a valid software license agreement with 29West Inc. Copyright © 2004-2014, Informatica, Inc. All Rights Reserved.