Package org.red5.io.utils
Class BufferUtils
java.lang.Object
org.red5.io.utils.BufferUtils
Buffer Utility class which reads/writes integers to the input/output buffer
- Author:
- The Red5 Project, Luke Hubbard, Codegent Ltd (luke@codegent.com), Andy Shaules (bowljoman@hotmail.com)
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic final byte[]
consumeBytes
(byte[] in, int numBytesMax) Consumes bytes from an input buffer and returns them in an output buffer.static final int
put
(org.apache.mina.core.buffer.IoBuffer out, org.apache.mina.core.buffer.IoBuffer in, int numBytesMax) Puts an input buffer in an output buffer and returns number of bytes written.static int
readMediumInt
(org.apache.mina.core.buffer.IoBuffer in) Reads a Medium Int to the in bufferstatic int
readUnsignedMediumInt
(org.apache.mina.core.buffer.IoBuffer in) Reads an unsigned Medium Int from the in bufferstatic void
writeMediumInt
(org.apache.mina.core.buffer.IoBuffer out, int value) Writes a Medium Int to the output buffer
-
Field Details
-
log
private static org.slf4j.Logger log
-
-
Constructor Details
-
BufferUtils
public BufferUtils()
-
-
Method Details
-
writeMediumInt
public static void writeMediumInt(org.apache.mina.core.buffer.IoBuffer out, int value) Writes a Medium Int to the output buffer- Parameters:
out
- Container to write tovalue
- Integer to write
-
readUnsignedMediumInt
public static int readUnsignedMediumInt(org.apache.mina.core.buffer.IoBuffer in) Reads an unsigned Medium Int from the in buffer- Parameters:
in
- Source- Returns:
- int Integer value
-
readMediumInt
public static int readMediumInt(org.apache.mina.core.buffer.IoBuffer in) Reads a Medium Int to the in buffer- Parameters:
in
- Source- Returns:
- int Medium int
-
put
public static final int put(org.apache.mina.core.buffer.IoBuffer out, org.apache.mina.core.buffer.IoBuffer in, int numBytesMax) Puts an input buffer in an output buffer and returns number of bytes written.- Parameters:
out
- Output bufferin
- Input buffernumBytesMax
- Number of bytes max- Returns:
- int Number of bytes written
-
consumeBytes
public static final byte[] consumeBytes(byte[] in, int numBytesMax) Consumes bytes from an input buffer and returns them in an output buffer.- Parameters:
in
- Input byte arraynumBytesMax
- Number of bytes max- Returns:
- out Output byte array
-