FileDocCategorySizeDatePackage
RealChunk.javaAPI DocJaudiotagger 2.0.42051Wed Mar 30 16:11:46 BST 2011org.jaudiotagger.audio.real

RealChunk

public class RealChunk extends Object

Fields Summary
protected static final String
RMF
protected static final String
PROP
protected static final String
MDPR
protected static final String
CONT
protected static final String
DATA
protected static final String
INDX
private final String
id
private final int
size
private final byte[]
bytes
Constructors Summary
public RealChunk(String id, int size, byte[] bytes)

		super();
		this.id = id;
		this.size = size;
		this.bytes = bytes;
	
Methods Summary
public byte[]getBytes()

		return bytes;
	
public java.io.DataInputStreamgetDataInputStream()

		return new DataInputStream(new ByteArrayInputStream(getBytes()));
	
public java.lang.StringgetId()

		return id;
	
public intgetSize()

		return size;
	
public booleanisCONT()

		return CONT.equals(id);
	
public booleanisPROP()

		return PROP.equals(id);
	
public static org.jaudiotagger.audio.real.RealChunkreadChunk(java.io.RandomAccessFile raf)


	    
			   
		final String id = Utils.readString(raf, 4);
		final int size = Utils.readUint32AsInt(raf);
		if (size < 8) {
			throw new CannotReadException(
					"Corrupt file: RealAudio chunk length at position "
							+ (raf.getFilePointer() - 4)
							+ " cannot be less than 8");
		}
		if (size > (raf.length() - raf.getFilePointer() + 8)) {
			throw new CannotReadException(
					"Corrupt file: RealAudio chunk length of " + size
							+ " at position " + (raf.getFilePointer() - 4)
							+ " extends beyond the end of the file");
		}
		final byte[] bytes = new byte[size - 8];
		raf.readFully(bytes);
		return new RealChunk(id, size, bytes);
	
public java.lang.StringtoString()

		return id + "\t" + size;