org.gagravarr.ogg
Class IOUtils

java.lang.Object
  extended by org.gagravarr.ogg.IOUtils

public class IOUtils
extends Object

Utilities for working with IO streams, such as reading and writing. Endian Note - Ogg and Vorbis tend to work in Little Endian format, while FLAC tends to work in Big Endian format.


Constructor Summary
IOUtils()
           
 
Method Summary
static byte fromInt(int i)
           
static int getInt(int i0, int i1)
           
static long getInt(int i0, int i1, int i2)
           
static long getInt(int i0, int i1, int i2, int i3)
           
static long getInt(int i0, int i1, int i2, int i3, int i4, int i5, int i6, int i7)
           
static int getInt2(byte[] data)
           
static int getInt2(byte[] data, int offset)
           
static int getInt2BE(byte[] data)
           
static int getInt2BE(byte[] data, int offset)
           
static long getInt3(byte[] data)
           
static long getInt3(byte[] data, int offset)
           
static long getInt3BE(byte[] data)
           
static long getInt3BE(byte[] data, int offset)
           
static long getInt4(byte[] data)
           
static long getInt4(byte[] data, int offset)
           
static long getInt4BE(byte[] data)
           
static long getInt4BE(byte[] data, int offset)
           
static long getInt8(byte[] data)
           
static long getInt8(byte[] data, int offset)
           
static int getIntBE(int i0, int i1)
           
static long getIntBE(int i0, int i1, int i2)
           
static long getIntBE(int i0, int i1, int i2, int i3)
           
static String getUTF8(byte[] data, int offset, int length)
           
static void putInt2(byte[] data, int offset, int v)
           
static void putInt2BE(byte[] data, int offset, int v)
           
static void putInt3(byte[] data, int offset, long v)
           
static void putInt3BE(byte[] data, int offset, long v)
           
static void putInt4(byte[] data, int offset, long v)
           
static void putInt4BE(byte[] data, int offset, long v)
           
static void putInt8(byte[] data, int offset, long v)
           
static int putUTF8(byte[] data, int offset, String str)
           
static void readFully(InputStream inp, byte[] destination)
           
static void readFully(InputStream inp, byte[] destination, int offset, int length)
           
static int toInt(byte b)
           
static void writeInt2(OutputStream out, int v)
           
static void writeInt2BE(OutputStream out, int v)
           
static void writeInt3(OutputStream out, long v)
           
static void writeInt3BE(OutputStream out, long v)
           
static void writeInt4(OutputStream out, long v)
           
static void writeInt4BE(OutputStream out, long v)
           
static void writeInt8(OutputStream out, long v)
           
static void writeUTF8(OutputStream out, String str)
          Writes the string out as UTF-8
static void writeUTF8WithLength(OutputStream out, String str)
          Writes out a 4 byte integer of the length (in bytes!) of the String, followed by the String (as UTF-8)
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IOUtils

public IOUtils()
Method Detail

readFully

public static void readFully(InputStream inp,
                             byte[] destination)
                      throws IOException
Throws:
IOException

readFully

public static void readFully(InputStream inp,
                             byte[] destination,
                             int offset,
                             int length)
                      throws IOException
Throws:
IOException

toInt

public static int toInt(byte b)

fromInt

public static byte fromInt(int i)

getInt2

public static int getInt2(byte[] data)

getInt2

public static int getInt2(byte[] data,
                          int offset)

getInt3

public static long getInt3(byte[] data)

getInt3

public static long getInt3(byte[] data,
                           int offset)

getInt4

public static long getInt4(byte[] data)

getInt4

public static long getInt4(byte[] data,
                           int offset)

getInt8

public static long getInt8(byte[] data)

getInt8

public static long getInt8(byte[] data,
                           int offset)

getInt

public static int getInt(int i0,
                         int i1)

getInt

public static long getInt(int i0,
                          int i1,
                          int i2)

getInt

public static long getInt(int i0,
                          int i1,
                          int i2,
                          int i3)

getInt

public static long getInt(int i0,
                          int i1,
                          int i2,
                          int i3,
                          int i4,
                          int i5,
                          int i6,
                          int i7)

getInt2BE

public static int getInt2BE(byte[] data)

getInt2BE

public static int getInt2BE(byte[] data,
                            int offset)

getInt3BE

public static long getInt3BE(byte[] data)

getInt3BE

public static long getInt3BE(byte[] data,
                             int offset)

getInt4BE

public static long getInt4BE(byte[] data)

getInt4BE

public static long getInt4BE(byte[] data,
                             int offset)

getIntBE

public static int getIntBE(int i0,
                           int i1)

getIntBE

public static long getIntBE(int i0,
                            int i1,
                            int i2)

getIntBE

public static long getIntBE(int i0,
                            int i1,
                            int i2,
                            int i3)

writeInt2

public static void writeInt2(OutputStream out,
                             int v)
                      throws IOException
Throws:
IOException

putInt2

public static void putInt2(byte[] data,
                           int offset,
                           int v)

writeInt3

public static void writeInt3(OutputStream out,
                             long v)
                      throws IOException
Throws:
IOException

putInt3

public static void putInt3(byte[] data,
                           int offset,
                           long v)

writeInt4

public static void writeInt4(OutputStream out,
                             long v)
                      throws IOException
Throws:
IOException

putInt4

public static void putInt4(byte[] data,
                           int offset,
                           long v)

writeInt8

public static void writeInt8(OutputStream out,
                             long v)
                      throws IOException
Throws:
IOException

putInt8

public static void putInt8(byte[] data,
                           int offset,
                           long v)

writeInt2BE

public static void writeInt2BE(OutputStream out,
                               int v)
                        throws IOException
Throws:
IOException

putInt2BE

public static void putInt2BE(byte[] data,
                             int offset,
                             int v)

writeInt3BE

public static void writeInt3BE(OutputStream out,
                               long v)
                        throws IOException
Throws:
IOException

putInt3BE

public static void putInt3BE(byte[] data,
                             int offset,
                             long v)

writeInt4BE

public static void writeInt4BE(OutputStream out,
                               long v)
                        throws IOException
Throws:
IOException

putInt4BE

public static void putInt4BE(byte[] data,
                             int offset,
                             long v)

getUTF8

public static String getUTF8(byte[] data,
                             int offset,
                             int length)
Parameters:
length - The length in BYTES

putUTF8

public static int putUTF8(byte[] data,
                          int offset,
                          String str)
Returns:
The length in BYTES

writeUTF8

public static void writeUTF8(OutputStream out,
                             String str)
                      throws IOException
Writes the string out as UTF-8

Throws:
IOException

writeUTF8WithLength

public static void writeUTF8WithLength(OutputStream out,
                                       String str)
                                throws IOException
Writes out a 4 byte integer of the length (in bytes!) of the String, followed by the String (as UTF-8)

Throws:
IOException


Copyright © 2012. All Rights Reserved.