Package org.h2.store.fs.zip
Class FileZip
- java.lang.Object
-
- java.nio.channels.spi.AbstractInterruptibleChannel
-
- java.nio.channels.FileChannel
-
- org.h2.store.fs.FileBase
-
- org.h2.store.fs.zip.FileZip
-
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable,java.nio.channels.ByteChannel,java.nio.channels.Channel,java.nio.channels.GatheringByteChannel,java.nio.channels.InterruptibleChannel,java.nio.channels.ReadableByteChannel,java.nio.channels.ScatteringByteChannel,java.nio.channels.SeekableByteChannel,java.nio.channels.WritableByteChannel
class FileZip extends FileBase
The file is read from a stream. When reading from start to end, the same input stream is re-used, however when reading from end to start, a new input stream is opened for each request.
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.zip.ZipEntryentryprivate java.util.zip.ZipFilefileprivate java.io.InputStreaminprivate longinPosprivate longlengthprivate longposprivate static byte[]SKIP_BUFFERprivate booleanskipUsingRead
-
Constructor Summary
Constructors Constructor Description FileZip(java.util.zip.ZipFile file, java.util.zip.ZipEntry entry)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidforce(boolean metaData)protected voidimplCloseChannel()longposition()java.nio.channels.FileChannelposition(long newPos)intread(java.nio.ByteBuffer dst)private voidseek()longsize()java.nio.channels.FileChanneltruncate(long newLength)java.nio.channels.FileLocktryLock(long position, long size, boolean shared)intwrite(java.nio.ByteBuffer src)-
Methods inherited from class org.h2.store.fs.FileBase
lock, map, read, read, transferFrom, transferTo, write, write
-
Methods inherited from class java.nio.channels.spi.AbstractInterruptibleChannel
begin, close, end, isOpen
-
-
-
-
Field Detail
-
SKIP_BUFFER
private static final byte[] SKIP_BUFFER
-
file
private final java.util.zip.ZipFile file
-
entry
private final java.util.zip.ZipEntry entry
-
pos
private long pos
-
in
private java.io.InputStream in
-
inPos
private long inPos
-
length
private final long length
-
skipUsingRead
private boolean skipUsingRead
-
-
Method Detail
-
position
public long position()
- Specified by:
positionin interfacejava.nio.channels.SeekableByteChannel- Specified by:
positionin classjava.nio.channels.FileChannel
-
size
public long size()
- Specified by:
sizein interfacejava.nio.channels.SeekableByteChannel- Specified by:
sizein classjava.nio.channels.FileChannel
-
read
public int read(java.nio.ByteBuffer dst) throws java.io.IOException- Specified by:
readin interfacejava.nio.channels.ReadableByteChannel- Specified by:
readin interfacejava.nio.channels.SeekableByteChannel- Specified by:
readin classjava.nio.channels.FileChannel- Throws:
java.io.IOException
-
seek
private void seek() throws java.io.IOException- Throws:
java.io.IOException
-
position
public java.nio.channels.FileChannel position(long newPos)
- Specified by:
positionin interfacejava.nio.channels.SeekableByteChannel- Specified by:
positionin classjava.nio.channels.FileChannel
-
truncate
public java.nio.channels.FileChannel truncate(long newLength) throws java.io.IOException- Specified by:
truncatein interfacejava.nio.channels.SeekableByteChannel- Specified by:
truncatein classjava.nio.channels.FileChannel- Throws:
java.io.IOException
-
force
public void force(boolean metaData) throws java.io.IOException
-
write
public int write(java.nio.ByteBuffer src) throws java.io.IOException- Specified by:
writein interfacejava.nio.channels.SeekableByteChannel- Specified by:
writein interfacejava.nio.channels.WritableByteChannel- Specified by:
writein classjava.nio.channels.FileChannel- Throws:
java.io.IOException
-
tryLock
public java.nio.channels.FileLock tryLock(long position, long size, boolean shared) throws java.io.IOException
-
implCloseChannel
protected void implCloseChannel() throws java.io.IOException- Overrides:
implCloseChannelin classFileBase- Throws:
java.io.IOException
-
-