FileDocCategorySizeDatePackage
ByteBuffer.javaAPI DocJMF 2.1.1e1779Mon May 12 12:20:44 BST 2003com.sun.media.util

ByteBuffer

public class ByteBuffer extends Object

Fields Summary
public byte[]
buffer
public int
offset
public int
length
public int
size
Constructors Summary
public ByteBuffer(int size)

	this.size = size;
	buffer = new byte[size];
    
Methods Summary
public final voidclear()

	offset = 0;
	length = 0;
    
public final voidwriteByte(byte value)

	buffer[offset] = value;
	offset++;
	length++;
    
public final voidwriteBytes(java.lang.String s)

	byte [] bytes = s.getBytes();
	writeBytes(bytes);
    
public final voidwriteBytes(byte[] bytes)

	System.arraycopy(bytes, 0,
			 buffer, offset, bytes.length);
	offset += bytes.length;
	length += bytes.length;
    
public final voidwriteInt(int value)

	buffer[offset + 0] = (byte)((value >> 24) & 0xFF);
	buffer[offset + 1] = (byte)((value >> 16) & 0xFF);
	buffer[offset + 2] = (byte)((value >>  8) & 0xFF);
	buffer[offset + 3] = (byte)((value >>  0) & 0xFF);
	offset += 4;
	length += 4;
    
public final voidwriteIntLittleEndian(int value)

	buffer[offset + 3] = (byte)((value >>> 24) & 0xFF);
	buffer[offset + 2] = (byte)((value >>> 16) & 0xFF);
	buffer[offset + 1] = (byte)((value >>>  8) & 0xFF);
	buffer[offset + 0] = (byte)((value >>>  0) & 0xFF);
	offset += 4;
	length += 4;
    
public final voidwriteShort(short value)

	buffer[offset + 0] = (byte)((value >> 8) & 0xFF);
	buffer[offset + 1] = (byte)((value >> 0) & 0xFF);
	offset += 2;
	length += 2;
    
public final voidwriteShortLittleEndian(short value)

	buffer[offset + 1] = (byte)((value >> 8) & 0xFF);
	buffer[offset + 0] = (byte)((value >> 0) & 0xFF);
	offset += 2;
	length += 2;