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

SSLInputStream

public abstract class SSLInputStream extends InputStream
This class is a base for all input stream classes used in protocol implementation. It extends an InputStream with some additional read methods allowing to read TLS specific data types such as uint8, uint32 etc (see TLS v 1 specification at http://www.ietf.org/rfc/rfc2246.txt).

Fields Summary
Constructors Summary
Methods Summary
public abstract intavailable()

see
java.io.InputStream#available()

public intread(byte[] b, int off, int len)

see
java.io.InputStream#read(byte[],int,int)

        int read_b;
        int i = 0;
        do {
            if ((read_b = read()) == -1) {
                return (i == 0) ? -1 : i;
            }
            b[off+i] = (byte) read_b;
            i++;
        } while ((available() != 0) && (i<len));
        return i;
    
public abstract intread()
Reads the following byte value. Note that in the case of reaching of the end of the data this methods throws the exception, not return -1. The type of exception depends on implementation. It was done for simplifying and speeding up of processing of such cases.

see
org.apache.harmony.xnet.provider.jsse.SSLStreamedInput#read()
see
org.apache.harmony.xnet.provider.jsse.SSLBufferedInput#read()
see
org.apache.harmony.xnet.provider.jsse.HandshakeIODataStream#read()

public byte[]read(int length)
Returns the vector of opaque values of specified length;

param
length - the length of the vector to be read.
return
the read data
throws
IOException if read operation could not be finished.

        byte[] res = new byte[length];
        for (int i=0; i<length; i++) {
            res[i] = (byte) read();
        }
        return res;
    
public intreadUint16()
Reads and returns uint16 value.

        return (read() << 8) | (read() & 0x00FF);
    
public intreadUint24()
Reads and returns uint24 value.

        return (read() << 16) | (read() << 8) | (read() & 0x00FF);
    
public longreadUint32()
Reads and returns uint32 value.

        return (read() << 24) | (read() << 16)
              | (read() << 8) | (read() & 0x00FF);
    
public longreadUint64()
Reads and returns uint64 value.

        return (read() << 56) | (read() << 48)
              | (read() << 40) | (read() << 32)
              | (read() << 24) | (read() << 16)
              | (read() << 8) | (read() & 0x00FF);
    
public intreadUint8()
Reads and returns uint8 value.

        return read() & 0x00FF;
    
public longskip(long n)

see
java.io.InputStream#skip(long)

        long skept = n;
        while (n > 0) {
            read();
            n--;
        }
        return skept;