Class 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
      void close()  
      boolean isOpen()  
      long position()  
      ElfByteChannel position​(long newPosition)  
      int read​(java.nio.ByteBuffer dst)
      Reads a sequence of bytes from this channel into the given buffer.
      int read​(java.nio.ByteBuffer dst, long position)
      Reads a sequence of bytes from this channel into the given buffer, starting at the given file position.
      long size()  
      ElfByteChannel truncate​(long size)  
      int write​(java.nio.ByteBuffer src)  
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ElfZipFileChannel

        public ElfZipFileChannel​(java.util.zip.ZipFile zipFile,
                                 java.util.zip.ZipEntry zipEntry)
                          throws java.io.IOException
        Throws:
        java.io.IOException
    • Method Detail

      • position

        public long position()
                      throws java.io.IOException
        Specified by:
        position in interface ElfByteChannel
        Throws:
        java.io.IOException
      • read

        public int read​(java.nio.ByteBuffer dst)
                 throws java.io.IOException
        Reads 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:
        read in interface ElfByteChannel
        Specified by:
        read in interface java.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.IOException
        Reads 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:
        read in interface ElfByteChannel
        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:
        size in interface ElfByteChannel
        Throws:
        java.io.IOException
      • write

        public int write​(java.nio.ByteBuffer src)
                  throws java.io.IOException
        Specified by:
        write in interface ElfByteChannel
        Specified by:
        write in interface java.nio.channels.WritableByteChannel
        Throws:
        java.io.IOException
      • isOpen

        public boolean isOpen()
        Specified by:
        isOpen in interface java.nio.channels.Channel
      • close

        public void close()
                   throws java.io.IOException
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.nio.channels.Channel
        Specified by:
        close in interface java.io.Closeable
        Throws:
        java.io.IOException