org.blinkenlights.jid3.io
Class ID3DataInputStream

java.lang.Object
  extended byjava.io.InputStream
      extended byjava.io.FilterInputStream
          extended byjava.io.DataInputStream
              extended byorg.blinkenlights.jid3.io.ID3DataInputStream
All Implemented Interfaces:
java.io.DataInput

public class ID3DataInputStream
extends java.io.DataInputStream


Field Summary
 
Fields inherited from class java.io.FilterInputStream
in
 
Constructor Summary
ID3DataInputStream(java.io.InputStream oIS)
           
 
Method Summary
 int readBE24()
          Read an unsigned big-endian 24-bit value and returns an int.
 int readBE32()
          Read a signed big-endian 32-bit value and returns an int.
 int readBEUnsigned16()
          Reads an unsigned big-endian 16-bit value and returns an int.
 int readID3Four()
          Read an encoded four byte value.
 java.lang.String readStringToNull()
          Read an ISO-8859-1 encoded string to null.
 java.lang.String readStringToNull(int iMaxLength)
          Read an ISO-8859-1 string to null, not exceeding a predefined length.
 java.lang.String readStringToNull(TextEncoding oTextEncoding)
          Read a string in the specified encoding format to null.
 java.lang.String readStringToNull(TextEncoding oTextEncoding, int iMaxLength)
          Read a string in the specified encoding format to null, not exceeding a predefined length.
 long readUnsignedBE32()
          Read an unsigned big-endian 32-bit value and returns a long.
 
Methods inherited from class java.io.DataInputStream
read, read, readBoolean, readByte, readChar, readDouble, readFloat, readFully, readFully, readInt, readLine, readLong, readShort, readUnsignedByte, readUnsignedShort, readUTF, readUTF, skipBytes
 
Methods inherited from class java.io.FilterInputStream
available, close, mark, markSupported, read, reset, skip
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ID3DataInputStream

public ID3DataInputStream(java.io.InputStream oIS)
Method Detail

readBEUnsigned16

public final int readBEUnsigned16()
                           throws java.io.IOException
Reads an unsigned big-endian 16-bit value and returns an int.

Returns:
the integer value read
Throws:
java.io.IOException

readBE24

public int readBE24()
             throws java.io.IOException
Read an unsigned big-endian 24-bit value and returns an int.

Returns:
the integer value read
Throws:
java.io.IOException

readBE32

public int readBE32()
             throws java.io.IOException
Read a signed big-endian 32-bit value and returns an int.

Returns:
the integer value read
Throws:
java.io.IOException

readUnsignedBE32

public long readUnsignedBE32()
                      throws java.io.IOException
Read an unsigned big-endian 32-bit value and returns a long.

Returns:
the long value read
Throws:
java.io.IOException

readID3Four

public int readID3Four()
                throws java.io.IOException,
                       ID3Exception
Read an encoded four byte value. The encoding method uses only the lowest seven bits of each byte, to prevent synchronization errors in the MP3 data stream.

Throws:
java.io.IOException
ID3Exception

readStringToNull

public java.lang.String readStringToNull()
                                  throws java.io.IOException
Read an ISO-8859-1 encoded string to null.

Returns:
a String, or null if string would be zero length
Throws:
java.io.IOException

readStringToNull

public java.lang.String readStringToNull(int iMaxLength)
                                  throws java.io.IOException
Read an ISO-8859-1 string to null, not exceeding a predefined length.

Parameters:
iMaxLength - a length beyond which not to read further
Returns:
a String, or null if string would be zero length
Throws:
java.io.IOException - on I/O error, or if string would exceed allowed length

readStringToNull

public java.lang.String readStringToNull(TextEncoding oTextEncoding)
                                  throws java.io.IOException
Read a string in the specified encoding format to null. Note that Unicode strings must be terminated by a double null (two zero bytes).

Parameters:
oTextEncoding - the encoding format of the string to be read
Returns:
a String, or null if string would be zero length
Throws:
java.io.IOException

readStringToNull

public java.lang.String readStringToNull(TextEncoding oTextEncoding,
                                         int iMaxLength)
                                  throws java.io.IOException
Read a string in the specified encoding format to null, not exceeding a predefined length. Note that Unicode strings must be terminated by a double null (two zero bytes).

Parameters:
oTextEncoding - the encoding format of the string to be read
iMaxLength - a length beyond which not to read further (in characters, not necessarily bytes)
Returns:
a String, or null if string would be zero length
Throws:
java.io.IOException - on I/O error, or if string would exceed allowed length