Package loci.common
Class ZipHandle
java.lang.Object
loci.common.StreamHandle
loci.common.ZipHandle
- All Implemented Interfaces:
DataInput,DataOutput,IRandomAccess
StreamHandle implementation for reading from Zip-compressed files
or byte arrays. Instances of ZipHandle are read-only.
- Author:
- Melissa Linkert melissa at glencoesoftware.com
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class loci.common.StreamHandle
StreamHandle.Settings -
Field Summary
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Closes this random access stream and releases any system resources associated with the stream.intstatic booleanprotected voidClose and reopen the stream; the stream pointer and mark should be reset to 0.Methods inherited from class loci.common.StreamHandle
exists, getFilePointer, getOrder, length, read, read, read, read, readBoolean, readByte, readChar, readDouble, readFloat, readFully, readFully, readInt, readLine, readLong, readShort, readUnsignedByte, readUnsignedShort, readUTF, seek, setOrder, skipBytes, skipBytes, write, write, write, write, write, writeBoolean, writeByte, writeBytes, writeChar, writeChars, writeDouble, writeFloat, writeInt, writeLong, writeShort, writeUTF
-
Constructor Details
-
ZipHandle
- Throws:
IOException
-
ZipHandle
Constructs a new ZipHandle corresponding to the given entry of the specified Zip file.- Parameters:
file- a name that can be passed toLocation.getHandle(String, boolean, boolean)entry- the specific entry in the Zip file to be opened- Throws:
HandleException- if the given file is not a Zip file.IOException- See Also:
-
-
Method Details
-
isZipFile
- Parameters:
file- a name that can be passed toLocation.getHandle(String, boolean, boolean)- Returns:
- true if the given filename is a Zip file.
- Throws:
IOException- if the file cannot be read
-
getEntryName
- Returns:
- the name of the backing Zip entry.
-
getInputStream
- Returns:
- the DataInputStream corresponding to the backing Zip entry.
-
getEntryCount
public int getEntryCount()- Returns:
- the number of entries.
-
close
Description copied from interface:IRandomAccessCloses this random access stream and releases any system resources associated with the stream.- Specified by:
closein interfaceIRandomAccess- Overrides:
closein classStreamHandle- Throws:
IOException- if the underlying stream(s) could not be closed
-
resetStream
Description copied from class:StreamHandleClose and reopen the stream; the stream pointer and mark should be reset to 0. This method is called if we need to seek backwards within the stream.- Specified by:
resetStreamin classStreamHandle- Throws:
IOException- if the stream cannot be reset
-