com.twelvemonkeys.imageio.stream
Class BufferedImageInputStream

java.lang.Object
  extended by javax.imageio.stream.ImageInputStreamImpl
      extended by com.twelvemonkeys.imageio.stream.BufferedImageInputStream
All Implemented Interfaces:
DataInput, ImageInputStream

public final class BufferedImageInputStream
extends ImageInputStreamImpl
implements ImageInputStream

A buffered ImageInputStream. Experimental - seems to be effective for FileImageInputStream and FileCacheImageInputStream when doing a lot of single-byte reads (or short byte-array reads) on OS X at least. Code that uses the readFully methods are not affected by the issue.

Version:
$Id: BufferedFileImageInputStream.java,v 1.0 May 15, 2008 4:36:49 PM haraldk Exp$
Author:
Harald Kuhr, last modified by $Author: haraldk$

Field Summary
 
Fields inherited from class javax.imageio.stream.ImageInputStreamImpl
bitOffset, byteOrder, flushedPos, streamPos
 
Constructor Summary
BufferedImageInputStream(ImageInputStream pStream)
           
 
Method Summary
 void close()
           
protected  void finalize()
           
 void flushBefore(long pos)
           
 long getFlushedPosition()
           
 boolean isCached()
           
 boolean isCachedFile()
           
 boolean isCachedMemory()
           
 long length()
           
 int read()
           
 int read(byte[] pBuffer, int pOffset, int pLength)
           
 void seek(long pPosition)
           
 
Methods inherited from class javax.imageio.stream.ImageInputStreamImpl
checkClosed, flush, getBitOffset, getByteOrder, getStreamPosition, mark, read, readBit, readBits, readBoolean, readByte, readBytes, readChar, readDouble, readFloat, readFully, readFully, readFully, readFully, readFully, readFully, readFully, readFully, readInt, readLine, readLong, readShort, readUnsignedByte, readUnsignedInt, readUnsignedShort, readUTF, reset, setBitOffset, setByteOrder, skipBytes, skipBytes
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.imageio.stream.ImageInputStream
flush, getBitOffset, getByteOrder, getStreamPosition, mark, read, readBit, readBits, readBoolean, readByte, readBytes, readChar, readDouble, readFloat, readFully, readFully, readFully, readFully, readFully, readFully, readFully, readFully, readInt, readLine, readLong, readShort, readUnsignedByte, readUnsignedInt, readUnsignedShort, readUTF, reset, setBitOffset, setByteOrder, skipBytes, skipBytes
 

Constructor Detail

BufferedImageInputStream

public BufferedImageInputStream(ImageInputStream pStream)
                         throws IOException
Throws:
IOException
Method Detail

read

public int read()
         throws IOException
Specified by:
read in interface ImageInputStream
Specified by:
read in class ImageInputStreamImpl
Throws:
IOException

read

public int read(byte[] pBuffer,
                int pOffset,
                int pLength)
         throws IOException
Specified by:
read in interface ImageInputStream
Specified by:
read in class ImageInputStreamImpl
Throws:
IOException

seek

public void seek(long pPosition)
          throws IOException
Specified by:
seek in interface ImageInputStream
Overrides:
seek in class ImageInputStreamImpl
Throws:
IOException

flushBefore

public void flushBefore(long pos)
                 throws IOException
Specified by:
flushBefore in interface ImageInputStream
Overrides:
flushBefore in class ImageInputStreamImpl
Throws:
IOException

getFlushedPosition

public long getFlushedPosition()
Specified by:
getFlushedPosition in interface ImageInputStream
Overrides:
getFlushedPosition in class ImageInputStreamImpl

isCached

public boolean isCached()
Specified by:
isCached in interface ImageInputStream
Overrides:
isCached in class ImageInputStreamImpl

isCachedMemory

public boolean isCachedMemory()
Specified by:
isCachedMemory in interface ImageInputStream
Overrides:
isCachedMemory in class ImageInputStreamImpl

isCachedFile

public boolean isCachedFile()
Specified by:
isCachedFile in interface ImageInputStream
Overrides:
isCachedFile in class ImageInputStreamImpl

close

public void close()
           throws IOException
Specified by:
close in interface ImageInputStream
Overrides:
close in class ImageInputStreamImpl
Throws:
IOException

finalize

protected void finalize()
                 throws Throwable
Overrides:
finalize in class ImageInputStreamImpl
Throws:
Throwable

length

public long length()
Specified by:
length in interface ImageInputStream
Overrides:
length in class ImageInputStreamImpl


Copyright © 2015. All Rights Reserved.