FileDocCategorySizeDatePackage
ID3DataOutputStream.javaAPI Docjid3 0.464392Sun Feb 06 18:11:25 GMT 2005org.blinkenlights.jid3.io

ID3DataOutputStream

public class ID3DataOutputStream extends DataOutputStream
author
paul Custom DataOutputStream containing convenience methods for writing ID3 tags.

Fields Summary
Constructors Summary
public ID3DataOutputStream(OutputStream oOS)

        super(oOS);
    
Methods Summary
public voidwriteBE24(int iValue)
Writes an unsigned big-endian 24-bit value. (Truncates any higher bits.)

param
iValue the 24-bit unsigned integer value to be written
throws
IOException

        int iOne = iValue & 0xff;
        int iTwo = (iValue >> 8) & 0xff;
        int iThree = (iValue >> 16) & 0xff;
        
        write(iThree);
        write(iTwo);
        write(iOne);
    
public voidwriteBE32(int iValue)
Writes a signed big-endian 32-bit value.

param
iValue the 32-bit signed integer value to be written
throws
IOException

        int iOne = iValue & 0xff;
        int iTwo = (iValue >> 8) & 0xff;
        int iThree = (iValue >> 16) & 0xff;
        int iFour = (iValue >> 24) & 0xff;
        
        write(iFour);
        write(iThree);
        write(iTwo);
        write(iOne);
    
public voidwriteBEUnsigned16(int iValue)
Writes an unsigned big-endian 16-bit value. (Truncates any higher bits.)

param
iValue the 16-bit unsigned integer value to be written
throws
IOException

        int iLo = iValue & 0xff;
        int iHi = iValue >> 8;
        
        write(iHi);
        write(iLo);
    
public voidwriteID3Four(int iValue)
Write 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.

        // we're only using the lower seven bits of each byte, so we can't write a value that
        // is greater than 28 bits can hold
        if (iValue >= (1 << 28))
        {
            throw new ID3Exception("Cannot write an encoded value greater than 28-bit unsigned.");
        }
        
        int iOne = ((iValue >> (3*7)) & 0x7f);
        int iTwo = ((iValue >> (2*7)) & 0x7f);
        int iThree = ((iValue >> (1*7)) & 0x7f);
        int iFour = (iValue & 0x7f);
        
        write(iOne);
        write(iTwo);
        write(iThree);
        write(iFour);
    
public voidwriteUnsignedBE32(long lValue)
Writes an unsigned big-endian 32-bit value.

param
lValue the 32-bit unsigned integer value to be written
throws
IOException

        int iOne = (int)(lValue & 0xff);
        int iTwo = (int)((lValue >> 8) & 0xff);
        int iThree = (int)((lValue >> 16) & 0xff);
        int iFour = (int)((lValue >> 24) & 0xff);
        
        write(iFour);
        write(iThree);
        write(iTwo);
        write(iOne);
    
public voidwriteUnsignedByte(int iValue)
Write an unsigned byte value.

param
iValue the unsigned byte value to be written
throws
IOException

        writeByte(iValue);