SerializableString (Jackson-core 2.0.2 API)
Date: 2012-05-14

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.fasterxml.jackson.core
Interface SerializableString

All Known Implementing Classes:
  SerializedString

    public interface SerializableString

Interface that defines how Jackson package can interact with efficient pre-serialized or lazily-serialized and reused String representations. Typically implementations store possible serialized version(s) so that serialization of String can be done more efficiently, especially when used multiple times.

See Also:
  `SerializedString`

Method Summary
`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)`
`int` | `putUnquotedUTF8(ByteBuffer out)`
`int` | `writeQuotedUTF8(OutputStream out)`
`int` | `writeUnquotedUTF8(OutputStream out)`

Method Detail

### getValue

    String getValue()

  Returns unquoted String that this object represents (and offers serialized forms for)

### charLength

    int charLength()

  Returns length of the (unquoted) String as characters. Functionally equvalent to:

         getValue().length();

### asQuotedChars

    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.

### asUnquotedUTF8

    byte[] asUnquotedUTF8()

  Returns UTF-8 encoded version of unquoted String. Functionally equivalent to (but more efficient than):

       getValue().getBytes("UTF-8");

### asQuotedUTF8

    byte[] asQuotedUTF8()

  Returns UTF-8 encoded version of JSON-quoted String. Functionally equivalent to (but more efficient than):

       new String(asQuotedChars()).getBytes("UTF-8");

### appendQuotedUTF8

    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
  Since:
    2.0

### appendQuoted

    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
  Since:
    2.0

### appendUnquotedUTF8

    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
  Since:
    2.0

### appendUnquoted

    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
  Since:
    2.0

### writeQuotedUTF8

    int writeQuotedUTF8(OutputStream out)
                        throws IOException

  Returns:
    Number of bytes written
  Throws:
    `IOException`
  Since:
    2.0

### writeUnquotedUTF8

    int writeUnquotedUTF8(OutputStream out)
                          throws IOException

  Returns:
    Number of bytes written
  Throws:
    `IOException`
  Since:
    2.0

### putQuotedUTF8

    int putQuotedUTF8(ByteBuffer buffer)
                      throws IOException

  Returns:
    Number of bytes put, if successful, otherwise -1
  Throws:
    `IOException`
  Since:
    2.0

### putUnquotedUTF8

    int putUnquotedUTF8(ByteBuffer out)
                        throws IOException

  Returns:
    Number of bytes put, if successful, otherwise -1
  Throws:
    `IOException`
  Since:
    2.0

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2012 fasterxml.com. All Rights Reserved.