org.red5.io.utils
Class IOUtils

java.lang.Object
  extended by org.red5.io.utils.IOUtils

public class IOUtils
extends Object

Miscellaneous I/O utility methods

See Also:
Unsigned bytes in Java

Field Summary
static Charset CHARSET
          UTF-8 is used
 
Constructor Summary
IOUtils()
           
 
Method Summary
static void debug(Logger log, String msg, IoBuffer buf)
          Format debug message
static void main(String[] args)
           
static int readExtendedMediumInt(ByteBuffer in)
          Reads extended medium int
static int readExtendedMediumInt(IoBuffer in)
          Reads extended medium int
static int readMediumInt(ByteBuffer in)
          Reads medium int
static int readMediumInt(IoBuffer in)
          Reads medium int
static int readReverseInt(IoBuffer in)
          Reads reverse int
static int readUnsignedMediumInt(IoBuffer in)
          Reads unsigned medium integer (3 bytes)
static String toString(IoBuffer buf)
          String representation of byte buffer
static void writeExtendedMediumInt(ByteBuffer out, int value)
          Writes extended medium integer (equivalent to a regular integer whose most significant byte has been moved to its end, past its least significant byte)
static void writeExtendedMediumInt(IoBuffer out, int value)
          Writes extended medium integer (equivalent to a regular integer whose most significant byte has been moved to its end, past its least significant byte)
static void writeMediumInt(ByteBuffer out, int value)
          Writes medium integer
static void writeMediumInt(IoBuffer out, int value)
          Writes medium integer
static void writeReverseInt(IoBuffer out, int value)
          Writes integer in reverse order
static void writeUnsignedByte(ByteBuffer out, byte value)
          Writes an unsigned byte value to the supplied buffer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CHARSET

public static final Charset CHARSET
UTF-8 is used

Constructor Detail

IOUtils

public IOUtils()
Method Detail

writeReverseInt

public static final void writeReverseInt(IoBuffer out,
                                         int value)
Writes integer in reverse order

Parameters:
out - Data buffer to fill
value - Integer

writeMediumInt

public static final void writeMediumInt(IoBuffer out,
                                        int value)
Writes medium integer

Parameters:
out - Output buffer
value - Integer to write

writeMediumInt

public static final void writeMediumInt(ByteBuffer out,
                                        int value)
Writes medium integer

Parameters:
out - Output buffer
value - Integer to write

writeExtendedMediumInt

public static final void writeExtendedMediumInt(IoBuffer out,
                                                int value)
Writes extended medium integer (equivalent to a regular integer whose most significant byte has been moved to its end, past its least significant byte)

Parameters:
out - Output buffer
value - Integer to write

writeExtendedMediumInt

public static final void writeExtendedMediumInt(ByteBuffer out,
                                                int value)
Writes extended medium integer (equivalent to a regular integer whose most significant byte has been moved to its end, past its least significant byte)

Parameters:
out - Output buffer
value - Integer to write

writeUnsignedByte

public static final void writeUnsignedByte(ByteBuffer out,
                                           byte value)
Writes an unsigned byte value to the supplied buffer.

Parameters:
out - Output buffer
value - Byte to write

readUnsignedMediumInt

public static final int readUnsignedMediumInt(IoBuffer in)
Reads unsigned medium integer (3 bytes)

Parameters:
in - Unsigned medium int source
Returns:
int value

readMediumInt

public static final int readMediumInt(ByteBuffer in)
Reads medium int

Parameters:
in - Source
Returns:
int value

readMediumInt

public static final int readMediumInt(IoBuffer in)
Reads medium int

Parameters:
in - Source
Returns:
int value

readExtendedMediumInt

public static final int readExtendedMediumInt(IoBuffer in)
Reads extended medium int

Parameters:
in - Source
Returns:
int value

readExtendedMediumInt

public static final int readExtendedMediumInt(ByteBuffer in)
Reads extended medium int

Parameters:
in - Source
Returns:
int value

readReverseInt

public static final int readReverseInt(IoBuffer in)
Reads reverse int

Parameters:
in - Source
Returns:
int

debug

public static final void debug(Logger log,
                               String msg,
                               IoBuffer buf)
Format debug message

Parameters:
log - Logger
msg - Message
buf - Byte buffer to debug

toString

public static final String toString(IoBuffer buf)
String representation of byte buffer

Parameters:
buf - Byte buffer
Returns:
String representation

main

public static void main(String[] args)


Copyright © 2006-2012 The Red5 Project