FileDocCategorySizeDatePackage
ImageInputStreamImpl.javaAPI DocAndroid 1.5 API10936Wed May 06 22:41:54 BST 2009javax.imageio.stream

ImageInputStreamImpl

public abstract class ImageInputStreamImpl extends Object implements ImageInputStream
The ImageInputStreamImpl abstract class implements the ImageInputStream interface.
since
Android 1.0

Fields Summary
protected ByteOrder
byteOrder
The byte order.
protected long
streamPos
The stream position.
protected long
flushedPos
The flushed position.
protected int
bitOffset
The bit offset.
private boolean
closed
The closed.
private final PositionStack
posStack
The position stack.
Constructors Summary
public ImageInputStreamImpl()
Instantiates a new ImageInputStreamImpl.


             
      
    
Methods Summary
protected final voidcheckClosed()
Check if the stream is closed and if true, throws an IOException.

throws
IOException if the stream is closed.

        if (closed) {
            throw new IOException("stream is closed");
        }
    
public voidclose()

        checkClosed();
        closed = true;

    
protected voidfinalize()
Finalizes this object.

throws
Throwable if an error occurs.

        if (!closed) {
            try {
                close();
            } finally {
                super.finalize();
            }
        }
    
public voidflush()

        flushBefore(getStreamPosition());
    
public voidflushBefore(long pos)

        if (pos > getStreamPosition()) {
            throw new IndexOutOfBoundsException("Trying to flush outside of current position");
        }
        if (pos < flushedPos) {
            throw new IndexOutOfBoundsException("Trying to flush within already flushed portion");
        }
        flushedPos = pos;
        // -- TODO implement
    
public intgetBitOffset()

        checkClosed();
        return bitOffset;
    
public java.nio.ByteOrdergetByteOrder()

        return byteOrder;
    
public longgetFlushedPosition()

        return flushedPos;
    
public longgetStreamPosition()

        checkClosed();
        return streamPos;
    
public booleanisCached()

        return false; // def
    
public booleanisCachedFile()

        return false; // def
    
public booleanisCachedMemory()

        return false; // def
    
public longlength()

        return -1L;
    
public voidmark()

        try {
            posStack.push(getStreamPosition());
        } catch (IOException e) {
            e.printStackTrace();
            throw new RuntimeException("Stream marking error");
        }
    
public abstract intread()

public intread(byte[] b)

        return read(b, 0, b.length);
    
public abstract intread(byte[] b, int off, int len)

public intreadBit()

        // -- TODO implement
        throw new UnsupportedOperationException("Not implemented yet");
    
public longreadBits(int numBits)

        // -- TODO implement
        throw new UnsupportedOperationException("Not implemented yet");
    
public booleanreadBoolean()

        int b = read();
        if (b < 0) {
            throw new EOFException("EOF reached");
        }
        return b != 0;
    
public bytereadByte()

        int b = read();
        if (b < 0) {
            throw new EOFException("EOF reached");
        }
        return (byte)b;
    
public voidreadBytes(javax.imageio.stream.IIOByteBuffer buf, int len)

        if (buf == null) {
            throw new NullPointerException("buffer is NULL");
        }

        byte[] b = new byte[len];
        len = read(b, 0, b.length);

        buf.setData(b);
        buf.setOffset(0);
        buf.setLength(len);
    
public charreadChar()

        // -- TODO implement
        throw new UnsupportedOperationException("Not implemented yet");
    
public doublereadDouble()

        // -- TODO implement
        throw new UnsupportedOperationException("Not implemented yet");
    
public floatreadFloat()

        // -- TODO implement
        throw new UnsupportedOperationException("Not implemented yet");
    
public voidreadFully(byte[] b, int off, int len)

        // -- TODO implement
        throw new UnsupportedOperationException("Not implemented yet");
    
public voidreadFully(byte[] b)

        readFully(b, 0, b.length);
    
public voidreadFully(short[] s, int off, int len)

        // -- TODO implement
        throw new UnsupportedOperationException("Not implemented yet");
    
public voidreadFully(char[] c, int off, int len)

        // -- TODO implement
        throw new UnsupportedOperationException("Not implemented yet");
    
public voidreadFully(int[] i, int off, int len)

        // -- TODO implement
        throw new UnsupportedOperationException("Not implemented yet");
    
public voidreadFully(long[] l, int off, int len)

        // -- TODO implement
        throw new UnsupportedOperationException("Not implemented yet");
    
public voidreadFully(float[] f, int off, int len)

        // -- TODO implement
        throw new UnsupportedOperationException("Not implemented yet");
    
public voidreadFully(double[] d, int off, int len)

        // -- TODO implement
        throw new UnsupportedOperationException("Not implemented yet");
    
public intreadInt()

        // -- TODO implement
        throw new UnsupportedOperationException("Not implemented yet");
    
public java.lang.StringreadLine()

        // -- TODO implement
        throw new UnsupportedOperationException("Not implemented yet");
    
public longreadLong()

        // -- TODO implement
        throw new UnsupportedOperationException("Not implemented yet");
    
public shortreadShort()

        int b1 = read();
        int b2 = read();

        if (b1 < 0 || b2 < 0) {
            throw new EOFException("EOF reached");
        }

        return byteOrder == ByteOrder.BIG_ENDIAN ? (short)((b1 << 8) | (b2 & 0xff))
                : (short)((b2 << 8) | (b1 & 0xff));
    
public java.lang.StringreadUTF()

        // -- TODO implement
        throw new UnsupportedOperationException("Not implemented yet");
    
public intreadUnsignedByte()

        int b = read();
        if (b < 0) {
            throw new EOFException("EOF reached");
        }
        return b;
    
public longreadUnsignedInt()

        // -- TODO implement
        throw new UnsupportedOperationException("Not implemented yet");
    
public intreadUnsignedShort()

        // -- TODO implement
        throw new UnsupportedOperationException("Not implemented yet");
    
public voidreset()

        // -- TODO bit pos
        if (!posStack.isEmpty()) {
            long p = posStack.pop();
            if (p < flushedPos) {
                throw new IOException("marked position lies in the flushed portion of the stream");
            }
            seek(p);
        }
    
public voidseek(long pos)

        checkClosed();
        if (pos < getFlushedPosition()) {
            throw new IllegalArgumentException("trying to seek before flushed pos");
        }
        bitOffset = 0;
        streamPos = pos;
    
public voidsetBitOffset(int bitOffset)

        checkClosed();
        this.bitOffset = bitOffset;
    
public voidsetByteOrder(java.nio.ByteOrder byteOrder)

        this.byteOrder = byteOrder;
    
public intskipBytes(int n)

        // -- TODO implement
        throw new UnsupportedOperationException("Not implemented yet");
    
public longskipBytes(long n)

        // -- TODO implement
        throw new UnsupportedOperationException("Not implemented yet");