Package com.facebook.soloader
Class ElfZipFileChannel
- java.lang.Object
-
- com.facebook.soloader.ElfZipFileChannel
-
- All Implemented Interfaces:
ElfByteChannel,java.io.Closeable,java.lang.AutoCloseable,java.nio.channels.ByteChannel,java.nio.channels.Channel,java.nio.channels.ReadableByteChannel,java.nio.channels.WritableByteChannel
public class ElfZipFileChannel extends java.lang.Object implements ElfByteChannel
-
-
Constructor Summary
Constructors Constructor Description ElfZipFileChannel(java.util.zip.ZipFile zipFile, java.util.zip.ZipEntry zipEntry)
-
Method Summary
Modifier and Type Method Description voidclose()booleanisOpen()longposition()ElfByteChannelposition(long newPosition)intread(java.nio.ByteBuffer dst)Reads a sequence of bytes from this channel into the given buffer.intread(java.nio.ByteBuffer dst, long position)Reads a sequence of bytes from this channel into the given buffer, starting at the given file position.longsize()ElfByteChanneltruncate(long size)intwrite(java.nio.ByteBuffer src)
-
-
-
Method Detail
-
position
public long position() throws java.io.IOException- Specified by:
positionin interfaceElfByteChannel- Throws:
java.io.IOException
-
position
public ElfByteChannel position(long newPosition) throws java.io.IOException
- Specified by:
positionin interfaceElfByteChannel- Throws:
java.io.IOException
-
read
public int read(java.nio.ByteBuffer dst) throws java.io.IOExceptionReads a sequence of bytes from this channel into the given buffer. Bytes are read starting at this channel's current file position, and then the file position is updated with the number of bytes actually read.- Specified by:
readin interfaceElfByteChannel- Specified by:
readin interfacejava.nio.channels.ReadableByteChannel- Returns:
- The number of bytes read, possibly zero, or -1 if the channel has reached end-of-stream
- Throws:
java.io.IOException
-
read
public int read(java.nio.ByteBuffer dst, long position) throws java.io.IOExceptionReads a sequence of bytes from this channel into the given buffer, starting at the given file position.N.B. The file position is updated with the number of bytes actually read. It's different from FileChannel.html#read(java.nio.ByteBuffer, long).
- Specified by:
readin interfaceElfByteChannel- Returns:
- The number of bytes read, possibly zero, or -1 if the given position is greater than or equal to the file's current size
- Throws:
java.io.IOException
-
size
public long size() throws java.io.IOException- Specified by:
sizein interfaceElfByteChannel- Throws:
java.io.IOException
-
truncate
public ElfByteChannel truncate(long size) throws java.io.IOException
- Specified by:
truncatein interfaceElfByteChannel- Throws:
java.io.IOException
-
write
public int write(java.nio.ByteBuffer src) throws java.io.IOException- Specified by:
writein interfaceElfByteChannel- Specified by:
writein interfacejava.nio.channels.WritableByteChannel- Throws:
java.io.IOException
-
isOpen
public boolean isOpen()
- Specified by:
isOpenin interfacejava.nio.channels.Channel
-
close
public void close() throws java.io.IOException- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.nio.channels.Channel- Specified by:
closein interfacejava.io.Closeable- Throws:
java.io.IOException
-
-