Class IOUtils

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

public class IOUtils extends Object
Miscellaneous I/O utility methods
Author:
mondain
See Also:
  • Field Details

    • CHARSET

      public static final Charset CHARSET
      Constant CHARSET
    • CHARSET_ASCII

      public static final Charset CHARSET_ASCII
      Constant CHARSET_ASCII
  • Constructor Details

    • IOUtils

      public IOUtils()
  • Method Details

    • writeReverseInt

      public static final void writeReverseInt(org.apache.mina.core.buffer.IoBuffer out, int value)
      Writes integer in reverse order
      Parameters:
      out - Data buffer to fill
      value - Integer
    • writeMediumInt

      public static final void writeMediumInt(org.apache.mina.core.buffer.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(org.apache.mina.core.buffer.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(ByteBuffer in)
      Reads unsigned medium integer (3 bytes)
      Parameters:
      in - Unsigned medium int source
      Returns:
      int value
    • readUnsignedMediumInt

      public static final int readUnsignedMediumInt(org.apache.mina.core.buffer.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(org.apache.mina.core.buffer.IoBuffer in)
      Reads medium int
      Parameters:
      in - Source
      Returns:
      int value
    • readExtendedMediumInt

      public static final int readExtendedMediumInt(org.apache.mina.core.buffer.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(org.apache.mina.core.buffer.IoBuffer in)
      Reads reverse int
      Parameters:
      in - Source
      Returns:
      int
    • debug

      public static final void debug(org.slf4j.Logger log, String msg, org.apache.mina.core.buffer.IoBuffer buf)
      Format debug message
      Parameters:
      log - Logger
      msg - Message
      buf - Byte buffer to debug
    • toString

      public static final String toString(org.apache.mina.core.buffer.IoBuffer buf)
      String representation of byte buffer
      Parameters:
      buf - Byte buffer
      Returns:
      String representation
    • hexStringToByteArray

      public static final byte[] hexStringToByteArray(String s)
      Returns a byte array for the given hex encoded string.
      Parameters:
      s - encoded hex string
      Returns:
      byte array
    • makeFourccBytes

      public static byte[] makeFourccBytes(String fourcc)
      Return fourcc as a byte array.
      Parameters:
      fourcc - a String object
      Returns:
      byte array representation of fourcc
    • makeFourcc

      public static int makeFourcc(String fourcc)
      Return fourcc as an integer.
      Parameters:
      fourcc - a String object
      Returns:
      integer representation of fourcc
    • getFourccString

      public static String getFourccString(int fourcc)
      Return fourcc as a string.
      Parameters:
      fourcc - a int
      Returns:
      string representation of fourcc
    • main

      public static void main(String[] args)

      main.

      Parameters:
      args - an array of String objects