org.spicefactory.cinnamon.io.util
Class IOUtil

java.lang.Object
  extended by org.spicefactory.cinnamon.io.util.IOUtil

public class IOUtil
extends Object

Utility methods and constants for AMF3 IO operations.

Author:
Jens Halm

Field Summary
static String AMF_MIME_TYPE
          The MIME type for AMF data.
static int DEFAULT_BUFFER_SIZE
          The default buffer size for IO operations.
static Charset UTF8_CHARSET
          The UTF-8 character set.
 
Constructor Summary
IOUtil()
           
 
Method Summary
static org.apache.mina.common.ByteBuffer read(InputStream input, int expectedLength)
          Reads from an InputStream and returns a ByteBuffer filled with all available data from the stream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

UTF8_CHARSET

public static final Charset UTF8_CHARSET
The UTF-8 character set.


AMF_MIME_TYPE

public static final String AMF_MIME_TYPE
The MIME type for AMF data.

See Also:
Constant Field Values

DEFAULT_BUFFER_SIZE

public static final int DEFAULT_BUFFER_SIZE
The default buffer size for IO operations.

See Also:
Constant Field Values
Constructor Detail

IOUtil

public IOUtil()
Method Detail

read

public static org.apache.mina.common.ByteBuffer read(InputStream input,
                                                     int expectedLength)
                                              throws IOException
Reads from an InputStream and returns a ByteBuffer filled with all available data from the stream. The expectedLength parameter just serves as a hint to optimize the initial buffer size. The number of bytes actually read into the buffer can be determined with calling ByteBuffer.limit().

Parameters:
input - the InputStream to read from
expectedLength - the expected number of available bytes
Returns:
a ByteBuffer filled with all available data from the stream
Throws:
IOException - when an IO error occurs while reading from the InputStream