org.codehaus.jackson.io
Class SerializedString

java.lang.Object
  extended by org.codehaus.jackson.io.SerializedString

public class SerializedString
extends Object

String token that can lazily serialize String contained and then reuse that serialization later on. This is similar to JDBC prepared statements, for example, in that instances should only be created when they are used more than use; prime candidates are various serializers.

Class is final for performance reasons and since this is not designed to be extensible or customizable (customizations would occur in calling code)

Since:
1.6

Field Summary
protected  char[] _quotedChars
          To save bit of memory, let's just use volatile for quoted characters; both because this is unlikely to be used as often, and because use cases are less of high performance ones to begin with.
protected  byte[] _quotedUTF8Ref
           
protected  byte[] _unquotedUTF8Ref
           
protected  String _value
           
 
Constructor Summary
SerializedString(String v)
           
 
Method Summary
 char[] asQuotedChars()
           
 byte[] asQuotedUTF8()
          Accessor for accessing value as is (without JSON quoting) encoded using UTF-8 encoding.
 byte[] asUnquotedUTF8()
          Accessor for accessing value that has been quoted using JSON quoting rules, and encoded using UTF-8 encoding.
 int charLength()
          Returns length of the String as characters
 String getValue()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_value

protected final String _value

_quotedUTF8Ref

protected volatile byte[] _quotedUTF8Ref

_unquotedUTF8Ref

protected volatile byte[] _unquotedUTF8Ref

_quotedChars

protected volatile char[] _quotedChars
To save bit of memory, let's just use volatile for quoted characters; both because this is unlikely to be used as often, and because use cases are less of high performance ones to begin with.

Constructor Detail

SerializedString

public SerializedString(String v)
Method Detail

getValue

public final String getValue()

charLength

public final int charLength()
Returns length of the String as characters


asQuotedChars

public char[] asQuotedChars()

asUnquotedUTF8

public byte[] asUnquotedUTF8()
Accessor for accessing value that has been quoted using JSON quoting rules, and encoded using UTF-8 encoding.


asQuotedUTF8

public byte[] asQuotedUTF8()
Accessor for accessing value as is (without JSON quoting) encoded using UTF-8 encoding.