Class Overview
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)
Summary
Public Methods |
int
|
appendQuoted(char[] buffer, int offset)
Method that will append quoted characters of this String into given
buffer.
|
int
|
appendQuotedUTF8(byte[] buffer, int offset)
Method that will append quoted UTF-8 bytes of this String into given
buffer, if there is enough room; if not, returns -1.
|
int
|
appendUnquoted(char[] buffer, int offset)
Method that will append unquoted characters of this String into given
buffer.
|
int
|
appendUnquotedUTF8(byte[] buffer, int offset)
Method that will append unquoted ('raw') UTF-8 bytes of this String into given
buffer.
|
final
char[]
|
asQuotedChars()
Returns JSON quoted form of the String, as character array.
|
final
byte[]
|
asQuotedUTF8()
Accessor for accessing value as is (without JSON quoting)
encoded using UTF-8 encoding.
|
final
byte[]
|
asUnquotedUTF8()
Accessor for accessing value that has been quoted using JSON
quoting rules, and encoded using UTF-8 encoding.
|
final
int
|
charLength()
Returns length of the String as characters
|
final
boolean
|
equals(Object o)
|
final
String
|
getValue()
Returns unquoted String that this object represents (and offers
serialized forms for)
|
final
int
|
hashCode()
|
int
|
putQuotedUTF8(ByteBuffer buffer)
|
int
|
putUnquotedUTF8(ByteBuffer buffer)
|
final
String
|
toString()
|
int
|
writeQuotedUTF8(OutputStream out)
|
int
|
writeUnquotedUTF8(OutputStream out)
|
[Expand]
Inherited Methods |
From class
java.lang.Object
Object
|
clone()
|
boolean
|
equals(Object arg0)
|
void
|
finalize()
|
final
Class<?>
|
getClass()
|
int
|
hashCode()
|
final
void
|
notify()
|
final
void
|
notifyAll()
|
String
|
toString()
|
final
void
|
wait()
|
final
void
|
wait(long arg0, int arg1)
|
final
void
|
wait(long arg0)
|
|
From interface
com.fasterxml.jackson.core.SerializableString
abstract
int
|
appendQuoted(char[] buffer, int offset)
Method that will append quoted characters of this String into given
buffer.
|
abstract
int
|
appendQuotedUTF8(byte[] buffer, int offset)
Method that will append quoted UTF-8 bytes of this String into given
buffer, if there is enough room; if not, returns -1.
|
abstract
int
|
appendUnquoted(char[] buffer, int offset)
Method that will append unquoted characters of this String into given
buffer.
|
abstract
int
|
appendUnquotedUTF8(byte[] buffer, int offset)
Method that will append unquoted ('raw') UTF-8 bytes of this String into given
buffer.
|
abstract
char[]
|
asQuotedChars()
Returns JSON quoted form of the String, as character array.
|
abstract
byte[]
|
asQuotedUTF8()
Returns UTF-8 encoded version of JSON-quoted String.
|
abstract
byte[]
|
asUnquotedUTF8()
Returns UTF-8 encoded version of unquoted String.
|
abstract
int
|
charLength()
Returns length of the (unquoted) String as characters.
|
abstract
String
|
getValue()
Returns unquoted String that this object represents (and offers
serialized forms for)
|
abstract
int
|
putQuotedUTF8(ByteBuffer buffer)
|
abstract
int
|
putUnquotedUTF8(ByteBuffer out)
|
abstract
int
|
writeQuotedUTF8(OutputStream out)
|
abstract
int
|
writeUnquotedUTF8(OutputStream out)
|
|
Fields
protected
char[]
_quotedChars
protected
byte[]
_quotedUTF8Ref
protected
byte[]
_unquotedUTF8Ref
Public Constructors
public
SerializedString
(String v)
Public Methods
public
int
appendQuoted
(char[] buffer, int offset)
Method that will append quoted characters of this String into given
buffer. Functionally equivalent to:
char[] ch = str.asQuotedChars();
System.arraycopy(ch, 0, buffer, offset, ch.length);
return ch.length;
Returns
- Number of characters appended, if successful, otherwise -1
public
int
appendQuotedUTF8
(byte[] buffer, int offset)
Method that will append quoted UTF-8 bytes of this String into given
buffer, if there is enough room; if not, returns -1.
Functionally equivalent to:
byte[] bytes = str.asQuotedUTF8();
System.arraycopy(bytes, 0, buffer, offset, bytes.length);
return bytes.length;
Returns
- Number of bytes appended, if successful, otherwise -1
public
int
appendUnquoted
(char[] buffer, int offset)
Method that will append unquoted characters of this String into given
buffer. Functionally equivalent to:
char[] ch = str.getValue().toCharArray();
System.arraycopy(bytes, 0, buffer, offset, ch.length);
return ch.length;
Returns
- Number of characters appended, if successful, otherwise -1
public
int
appendUnquotedUTF8
(byte[] buffer, int offset)
Method that will append unquoted ('raw') UTF-8 bytes of this String into given
buffer. Functionally equivalent to:
byte[] bytes = str.asUnquotedUTF8();
System.arraycopy(bytes, 0, buffer, offset, bytes.length);
return bytes.length;
Returns
- Number of bytes appended, if successful, otherwise -1
public
final
char[]
asQuotedChars
()
Returns JSON quoted form of the String, as character array. Result
can be embedded as-is in textual JSON as property name or JSON String.
public
final
byte[]
asQuotedUTF8
()
Accessor for accessing value as is (without JSON quoting)
encoded using UTF-8 encoding.
public
final
byte[]
asUnquotedUTF8
()
Accessor for accessing value that has been quoted using JSON
quoting rules, and encoded using UTF-8 encoding.
public
final
int
charLength
()
Returns length of the String as characters
public
final
boolean
equals
(Object o)
public
final
String
getValue
()
Returns unquoted String that this object represents (and offers
serialized forms for)
public
final
int
hashCode
()
public
int
putQuotedUTF8
(ByteBuffer buffer)
public
int
putUnquotedUTF8
(ByteBuffer buffer)
public
final
String
toString
()