Class SegmentConsumer.Token

java.lang.Object
org.simpleframework.http.message.SegmentConsumer.Token
Enclosing class:
SegmentConsumer

private class SegmentConsumer.Token extends Object
This is used to track the boundaries of a token so that it can be converted in to a usable string. This will track the length and offset within the consumed array of the token. When the token is to be used it can be converted in to a string.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    int
    This is used to mark the start offset within the array.
    int
    This is used to track the number of bytes within the array.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Token(int off, int size)
    Constructor for the Token object.
  • Method Summary

    Modifier and Type
    Method
    Description
    This is used to convert the byte range to a string.
    text(String charset)
    This is used to convert the byte range to a string.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • size

      public int size
      This is used to track the number of bytes within the array.
    • off

      public int off
      This is used to mark the start offset within the array.
  • Constructor Details

    • Token

      public Token(int off, int size)
      Constructor for the Token object. This is used to create a new token to track the range of bytes that will be used to create a string representing the parsed value.
      Parameters:
      off - the starting offset for the token range
      size - the number of bytes used for the token
  • Method Details

    • text

      public String text()
      This is used to convert the byte range to a string. This will use UTF-8 encoding for the string which is compatible with the HTTP default header encoding of ISO-8859-1.
      Returns:
      the encoded string representing the token
    • text

      public String text(String charset)
      This is used to convert the byte range to a string. This will use specified encoding, if that encoding is not supported then this will return null for the token value.
      Returns:
      the encoded string representing the token