Class PathImageInputStream
java.lang.Object
javax.imageio.stream.ImageInputStreamImpl
is.galia.stream.PathImageInputStream
- All Implemented Interfaces:
Closeable,DataInput,AutoCloseable,ImageInputStream
Analog of FileImageInputStream that uses
Paths instead of Files.
Also, unlike FileImageInputStream which is
backed by a RandomAccessFile, this implementation is backed
by a faster buffered implementation.
-
Field Summary
Fields inherited from class javax.imageio.stream.ImageInputStreamImpl
bitOffset, byteOrder, flushedPos, streamPos -
Constructor Summary
ConstructorsConstructorDescriptionPathImageInputStream(Path path) Constructs an instance that will read from a givenPath. -
Method Summary
Methods inherited from class javax.imageio.stream.ImageInputStreamImpl
checkClosed, finalize, flush, flushBefore, getBitOffset, getByteOrder, getFlushedPosition, getStreamPosition, isCached, isCachedFile, isCachedMemory, 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, skipBytesMethods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface javax.imageio.stream.ImageInputStream
flush, flushBefore, getBitOffset, getByteOrder, getFlushedPosition, getStreamPosition, isCached, isCachedFile, isCachedMemory, 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 Details
-
PathImageInputStream
Constructs an instance that will read from a given
Path.The file contents must not change between the time this object is constructed and the time of the last call to a read method.
- Parameters:
path- Path to read from.- Throws:
NoSuchFileException- ifpathis a directory or cannot be opened for reading for any other reason.IOException- if an I/O error occurs.
-
-
Method Details
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein interfaceImageInputStream- Overrides:
closein classImageInputStreamImpl- Throws:
IOException
-
length
public long length()- Specified by:
lengthin interfaceImageInputStream- Overrides:
lengthin classImageInputStreamImpl
-
read
- Specified by:
readin interfaceImageInputStream- Specified by:
readin classImageInputStreamImpl- Throws:
IOException
-
read
- Specified by:
readin interfaceImageInputStream- Specified by:
readin classImageInputStreamImpl- Throws:
IOException
-
seek
- Specified by:
seekin interfaceImageInputStream- Overrides:
seekin classImageInputStreamImpl- Throws:
IOException
-