FileDocCategorySizeDatePackage
SSLBufferedInput.javaAPI DocAndroid 1.5 API2456Wed May 06 22:41:06 BST 2009org.apache.harmony.xnet.provider.jsse

SSLBufferedInput

public class SSLBufferedInput extends org.apache.harmony.xnet.provider.jsse.SSLInputStream
This is a wrapper input stream for ByteBuffer data source. Among with the read functionality it provides info about number of cunsumed bytes from the source ByteBuffer. The source ByteBuffer object can be reseted. So one instance of this wrapper can be reused for several ByteBuffer data sources.

Fields Summary
private ByteBuffer
in
private int
bytik
private int
consumed
Constructors Summary
protected SSLBufferedInput()
Constructor


          
      
Methods Summary
public intavailable()
Returns the number of bytes available for reading.

        // in assumption that the buffer has been set
        return in.remaining();
    
protected intconsumed()
Returns the number of consumed bytes.

        return consumed;
    
public intread()
Reads the following byte value. If there are no bytes in the source buffer, method throws java.nio.BufferUnderflowException.

        // TODO: implement optimized read(int) 
        // and read(byte[], int, int) methods
        bytik = in.get() & 0x00FF;
        consumed ++;
        return bytik;
    
protected voidsetSourceBuffer(java.nio.ByteBuffer in)
Sets the buffer as a data source

        consumed = 0;
        this.in = in;