public interface SerializableString
Note that "quoted" in methods means quoting of 'special' characters using JSON backlash notation (and not use of actual double quotes).
SerializedString
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()
Returns JSON quoted form of the String, as character array.
|
byte[] |
asQuotedUTF8()
Returns UTF-8 encoded version of JSON-quoted String.
|
byte[] |
asUnquotedUTF8()
Returns UTF-8 encoded version of unquoted String.
|
int |
charLength()
Returns length of the (unquoted) String as characters.
|
String |
getValue()
Returns unquoted String that this object represents (and offers
serialized forms for)
|
int |
putQuotedUTF8(ByteBuffer buffer)
Method for appending JSON-escaped UTF-8 encoded String value into given
ByteBuffer , if it fits. |
int |
putUnquotedUTF8(ByteBuffer buffer)
Method for appending unquoted ('raw') UTF-8 encoded String value into given
ByteBuffer , if it fits. |
int |
writeQuotedUTF8(OutputStream out)
Method for writing JSON-escaped UTF-8 encoded String value using given
OutputStream . |
int |
writeUnquotedUTF8(OutputStream out)
Method for writing unescaped UTF-8 encoded String value using given
OutputStream . |
String getValue()
int charLength()
getValue().length();
char[] asQuotedChars()
char[]
byte[] asUnquotedUTF8()
getValue().getBytes("UTF-8");
byte[] asQuotedUTF8()
new String(asQuotedChars()).getBytes("UTF-8");
int appendQuotedUTF8(byte[] buffer, int offset)
byte[] bytes = str.asQuotedUTF8(); System.arraycopy(bytes, 0, buffer, offset, bytes.length); return bytes.length;
buffer
- Buffer to append JSON-escaped String intooffset
- Offset in buffer
to append String atint appendQuoted(char[] buffer, int offset)
char[] ch = str.asQuotedChars(); System.arraycopy(ch, 0, buffer, offset, ch.length); return ch.length;
buffer
- Buffer to append JSON-escaped String intooffset
- Offset in buffer
to append String atint appendUnquotedUTF8(byte[] buffer, int offset)
byte[] bytes = str.asUnquotedUTF8(); System.arraycopy(bytes, 0, buffer, offset, bytes.length); return bytes.length;
buffer
- Buffer to append literal (unescaped) String intooffset
- Offset in buffer
to append String atint appendUnquoted(char[] buffer, int offset)
char[] ch = str.getValue().toCharArray(); System.arraycopy(bytes, 0, buffer, offset, ch.length); return ch.length;
buffer
- Buffer to append literal (unescaped) String intooffset
- Offset in buffer
to append String atint writeQuotedUTF8(OutputStream out) throws IOException
OutputStream
.out
- OutputStream
to write String intoIOException
- if underlying stream write failsint writeUnquotedUTF8(OutputStream out) throws IOException
OutputStream
.out
- OutputStream
to write String intoIOException
- if underlying stream write failsint putQuotedUTF8(ByteBuffer buffer) throws IOException
ByteBuffer
, if it fits.buffer
- ByteBuffer
to append String intoIOException
- if underlying buffer append operation failsint putUnquotedUTF8(ByteBuffer buffer) throws IOException
ByteBuffer
, if it fits.buffer
- ByteBuffer
to append String intoIOException
- if underlying buffer append operation failsCopyright © 2021 JBoss by Red Hat. All rights reserved.