com.go.trove.io
Interface CharToByteBuffer

All Superinterfaces:
ByteBuffer, ByteData
All Known Subinterfaces:
CharToByteBuffer
All Known Implementing Classes:
DefaultCharToByteBuffer, FastCharToByteBuffer, InternedCharToByteBuffer

public interface CharToByteBuffer
extends ByteBuffer

A ByteBuffer that accepts characters and Strings as well.

Version:
14 , 01/04/18
Author:
Brian S O'Neill

Method Summary
 void append(char c)
          Add one character to the end of this buffer.
 void append(char[] chars)
          Copy the given characters to the end of this buffer.
 void append(char[] chars, int offset, int length)
          Copy the given characters to the end of this buffer, starting at the offset, using the length provided.
 void append(java.lang.String str)
          Copy the given String to the end of this buffer.
 void append(java.lang.String str, int offset, int length)
          Copy the given String to the end of this buffer, starting at the offset, using the length provided.
 void drain()
          Force any buffered characters to be immediately converted to bytes.
 java.lang.String getEncoding()
          Returns the current encoding that is being used to convert characters to bytes or null if no encoding has been set yet.
 void setEncoding(java.lang.String enc)
          Set the encoding for converting characters to bytes.
 
Methods inherited from interface com.go.trove.io.ByteBuffer
addCaptureBuffer, append, append, append, appendSurrogate, getBaseByteCount, removeCaptureBuffer
 
Methods inherited from interface com.go.trove.io.ByteData
getByteCount, reset, writeTo
 

Method Detail

setEncoding

public void setEncoding(java.lang.String enc)
                 throws java.io.IOException,
                        java.io.UnsupportedEncodingException
Set the encoding for converting characters to bytes. Calling getEncoding will return the canonical encoding name and may differ from the encoding name provided to this method.

getEncoding

public java.lang.String getEncoding()
                             throws java.io.IOException
Returns the current encoding that is being used to convert characters to bytes or null if no encoding has been set yet. The encoding name that is returned is canonical and may differ from the name passed into setEncoding.

append

public void append(char c)
            throws java.io.IOException
Add one character to the end of this buffer.

append

public void append(char[] chars)
            throws java.io.IOException
Copy the given characters to the end of this buffer.

append

public void append(char[] chars,
                   int offset,
                   int length)
            throws java.io.IOException
Copy the given characters to the end of this buffer, starting at the offset, using the length provided.

append

public void append(java.lang.String str)
            throws java.io.IOException
Copy the given String to the end of this buffer.

append

public void append(java.lang.String str,
                   int offset,
                   int length)
            throws java.io.IOException
Copy the given String to the end of this buffer, starting at the offset, using the length provided.

drain

public void drain()
           throws java.io.IOException
Force any buffered characters to be immediately converted to bytes.