public class SerializedString extends java.lang.Object implements SerializableString, java.io.Serializable
Class is final for performance reasons and since this is not designed to be extensible or customizable (customizations would occur in calling code)
Constructor and Description |
---|
SerializedString(java.lang.String v) |
Modifier and Type | Method and Description |
---|---|
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.
|
char[] |
asQuotedChars()
Accessor for accessing value that has been quoted (escaped) using JSON
quoting rules (using backslash-prefixed codes) into a char array.
|
byte[] |
asQuotedUTF8()
Accessor for accessing value that has been quoted (escaped) using JSON
quoting rules (using backslash-prefixed codes), and encoded using
UTF-8 encoding into a byte array.
|
byte[] |
asUnquotedUTF8()
Accessor for accessing value as is (without JSON quoting (ecaping))
encoded as UTF-8 byte array.
|
int |
charLength()
Returns length of the String as characters
|
boolean |
equals(java.lang.Object o) |
java.lang.String |
getValue()
Returns unquoted String that this object represents (and offers
serialized forms for)
|
int |
hashCode() |
int |
putQuotedUTF8(java.nio.ByteBuffer buffer)
Method for appending JSON-escaped UTF-8 encoded String value into given
ByteBuffer , if it fits. |
int |
putUnquotedUTF8(java.nio.ByteBuffer buffer)
Method for appending unquoted ('raw') UTF-8 encoded String value into given
ByteBuffer , if it fits. |
java.lang.String |
toString() |
int |
writeQuotedUTF8(java.io.OutputStream out)
Method for writing JSON-escaped UTF-8 encoded String value using given
OutputStream . |
int |
writeUnquotedUTF8(java.io.OutputStream out)
Method for writing unescaped UTF-8 encoded String value using given
OutputStream . |
public final java.lang.String getValue()
SerializableString
getValue
in interface SerializableString
public final int charLength()
charLength
in interface SerializableString
public final char[] asQuotedChars()
asQuotedChars
in interface SerializableString
char[]
public final byte[] asQuotedUTF8()
asQuotedUTF8
in interface SerializableString
public final byte[] asUnquotedUTF8()
asUnquotedUTF8
in interface SerializableString
public int appendQuoted(char[] buffer, int offset)
SerializableString
char[] ch = str.asQuotedChars(); System.arraycopy(ch, 0, buffer, offset, ch.length); return ch.length;
appendQuoted
in interface SerializableString
buffer
- Buffer to append JSON-escaped String intooffset
- Offset in buffer
to append String atpublic int appendQuotedUTF8(byte[] buffer, int offset)
SerializableString
byte[] bytes = str.asQuotedUTF8(); System.arraycopy(bytes, 0, buffer, offset, bytes.length); return bytes.length;
appendQuotedUTF8
in interface SerializableString
buffer
- Buffer to append JSON-escaped String intooffset
- Offset in buffer
to append String atpublic int appendUnquoted(char[] buffer, int offset)
SerializableString
char[] ch = str.getValue().toCharArray(); System.arraycopy(bytes, 0, buffer, offset, ch.length); return ch.length;
appendUnquoted
in interface SerializableString
buffer
- Buffer to append literal (unescaped) String intooffset
- Offset in buffer
to append String atpublic int appendUnquotedUTF8(byte[] buffer, int offset)
SerializableString
byte[] bytes = str.asUnquotedUTF8(); System.arraycopy(bytes, 0, buffer, offset, bytes.length); return bytes.length;
appendUnquotedUTF8
in interface SerializableString
buffer
- Buffer to append literal (unescaped) String intooffset
- Offset in buffer
to append String atpublic int writeQuotedUTF8(java.io.OutputStream out) throws java.io.IOException
SerializableString
OutputStream
.writeQuotedUTF8
in interface SerializableString
out
- OutputStream
to write String intojava.io.IOException
- if underlying stream write failspublic int writeUnquotedUTF8(java.io.OutputStream out) throws java.io.IOException
SerializableString
OutputStream
.writeUnquotedUTF8
in interface SerializableString
out
- OutputStream
to write String intojava.io.IOException
- if underlying stream write failspublic int putQuotedUTF8(java.nio.ByteBuffer buffer)
SerializableString
ByteBuffer
, if it fits.putQuotedUTF8
in interface SerializableString
buffer
- ByteBuffer
to append String intopublic int putUnquotedUTF8(java.nio.ByteBuffer buffer)
SerializableString
ByteBuffer
, if it fits.putUnquotedUTF8
in interface SerializableString
buffer
- ByteBuffer
to append String intopublic final java.lang.String toString()
toString
in class java.lang.Object
public final int hashCode()
hashCode
in class java.lang.Object
public final boolean equals(java.lang.Object o)
equals
in class java.lang.Object
Copyright © 2010 - 2023 Adobe. All Rights Reserved