Class ZipResource

  • All Implemented Interfaces:
    Resource, java.io.Closeable, java.lang.AutoCloseable

    public class ZipResource
    extends java.lang.Object
    implements Resource
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.nio.ByteBuffer buffer  
      private boolean closeZipFile  
      private java.util.zip.ZipEntry entry  
      private java.lang.String extra  
      private long lastModified  
      private long size  
      private java.util.zip.ZipFile zip  
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      (package private) ZipResource​(java.nio.file.Path path, java.lang.String entryName)  
      private ZipResource​(java.util.zip.ZipFile zip, java.lang.String entryName)  
      (package private) ZipResource​(java.util.zip.ZipFile zip, java.util.zip.ZipEntry entry)  
      private ZipResource​(java.util.zip.ZipFile zip, java.util.zip.ZipEntry entry, boolean closeZipFile)  
    • Field Detail

      • buffer

        private java.nio.ByteBuffer buffer
      • zip

        private final java.util.zip.ZipFile zip
      • entry

        private final java.util.zip.ZipEntry entry
      • closeZipFile

        private final boolean closeZipFile
      • lastModified

        private long lastModified
      • size

        private long size
      • extra

        private java.lang.String extra
    • Constructor Detail

      • ZipResource

        ZipResource​(java.nio.file.Path path,
                    java.lang.String entryName)
             throws java.io.IOException
        Throws:
        java.io.IOException
      • ZipResource

        private ZipResource​(java.util.zip.ZipFile zip,
                            java.lang.String entryName)
                     throws java.io.IOException
        Throws:
        java.io.IOException
      • ZipResource

        ZipResource​(java.util.zip.ZipFile zip,
                    java.util.zip.ZipEntry entry)
      • ZipResource

        private ZipResource​(java.util.zip.ZipFile zip,
                            java.util.zip.ZipEntry entry,
                            boolean closeZipFile)
    • Method Detail

      • buffer

        public java.nio.ByteBuffer buffer()
                                   throws java.lang.Exception
        Specified by:
        buffer in interface Resource
        Throws:
        java.lang.Exception
      • getBuffer

        private java.nio.ByteBuffer getBuffer()
                                       throws java.lang.Exception
        Throws:
        java.lang.Exception
      • openInputStream

        public java.io.InputStream openInputStream()
                                            throws java.lang.Exception
        Specified by:
        openInputStream in interface Resource
        Throws:
        java.lang.Exception
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • write

        public void write​(java.io.OutputStream out)
                   throws java.lang.Exception
        Specified by:
        write in interface Resource
        Throws:
        java.lang.Exception
      • getExtra

        public java.lang.String getExtra()
        Description copied from interface: Resource
        Use Resource.decodeExtra(String) to properly decode the ZIP extra field structured binary data from the returned String.
        Specified by:
        getExtra in interface Resource
        Returns:
        A String encoding the ZIP extra field.
      • setExtra

        public void setExtra​(java.lang.String extra)
        Description copied from interface: Resource
        Use Resource.encodeExtra(byte[]) to properly encode the ZIP extra field structured binary data into the specified String.
        Specified by:
        setExtra in interface Resource
        Parameters:
        extra - A String encoding the ZIP extra field.
      • size

        public long size()
                  throws java.lang.Exception
        Specified by:
        size in interface Resource
        Throws:
        java.lang.Exception
      • close

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