FileDocCategorySizeDatePackage
ByteBufferByteChannel.javaAPI Docmp4parser 1.0-RC-171654Wed Dec 19 20:10:37 GMT 2012com.googlecode.mp4parser.util

ByteBufferByteChannel

public class ByteBufferByteChannel extends Object implements ByteChannel
Creates a ReadableByteChannel that is backed by a ByteBuffer.

Fields Summary
ByteBuffer
byteBuffer
Constructors Summary
public ByteBufferByteChannel(ByteBuffer byteBuffer)

        this.byteBuffer = byteBuffer;
    
Methods Summary
public voidclose()

    
public booleanisOpen()

        return true;
    
public intread(java.nio.ByteBuffer dst)

        byte[] b = dst.array();
        int r = dst.remaining();
        if (byteBuffer.remaining() >= r) {
            byteBuffer.get(b, dst.position(), r);
            return r;
        } else {
            throw new EOFException("Reading beyond end of stream");
        }
    
public intwrite(java.nio.ByteBuffer src)

        int r = src.remaining();
        byteBuffer.put(src);
        return r;