Class ByteArrayWindow


  • final class ByteArrayWindow
    extends ByteWindow
    A ByteWindow with an underlying byte array for storage.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private byte[] array  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      (package private) void check​(java.util.zip.Inflater inf, byte[] tmp, long pos, int cnt)  
      protected int copy​(int p, byte[] b, int o, int n)
      Copy bytes from the window to a caller supplied buffer.
      (package private) void crc32​(java.util.zip.CRC32 out, long pos, int cnt)  
      protected int setInput​(int pos, java.util.zip.Inflater inf)
      Set the input
      (package private) void write​(PackOutputStream out, long pos, int cnt)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • array

        private final byte[] array
    • Constructor Detail

      • ByteArrayWindow

        ByteArrayWindow​(PackFile pack,
                        long o,
                        byte[] b)
    • Method Detail

      • copy

        protected int copy​(int p,
                           byte[] b,
                           int o,
                           int n)
        Copy bytes from the window to a caller supplied buffer.
        Specified by:
        copy in class ByteWindow
        Parameters:
        p - offset within the window to start copying from.
        b - destination buffer to copy into.
        o - offset within dstbuf to start copying into.
        n - number of bytes to copy. This value may exceed the number of bytes remaining in the window starting at offset pos.
        Returns:
        number of bytes actually copied; this may be less than cnt if cnt exceeded the number of bytes available.
      • setInput

        protected int setInput​(int pos,
                               java.util.zip.Inflater inf)
                        throws java.util.zip.DataFormatException
        Set the input
        Specified by:
        setInput in class ByteWindow
        Parameters:
        pos - position
        inf - an Inflater object.
        Returns:
        size of the byte window
        Throws:
        java.util.zip.DataFormatException - if any.
      • crc32

        void crc32​(java.util.zip.CRC32 out,
                   long pos,
                   int cnt)
      • write

        void write​(PackOutputStream out,
                   long pos,
                   int cnt)
            throws java.io.IOException
        Specified by:
        write in class ByteWindow
        Throws:
        java.io.IOException
      • check

        void check​(java.util.zip.Inflater inf,
                   byte[] tmp,
                   long pos,
                   int cnt)
            throws java.util.zip.DataFormatException
        Throws:
        java.util.zip.DataFormatException