Class DfsInserter.PackStream

  • All Implemented Interfaces:
    java.io.Closeable, java.io.Flushable, java.lang.AutoCloseable
    Enclosing class:
    DfsInserter

    private class DfsInserter.PackStream
    extends java.io.OutputStream
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private int blockSize  
      (package private) java.util.zip.DeflaterOutputStream compress  
      (package private) java.util.zip.CRC32 crc32  
      private byte[] currBuf  
      private long currPos  
      private int currPtr  
      private java.util.zip.Deflater deflater  
      (package private) byte[] hdrBuf  
      private java.security.MessageDigest md  
      private DfsOutputStream out  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      (package private) void beginObject​(int objectType, long length)  
      void close()  
      private byte[] copyOf​(byte[] src, int ptr, int cnt)  
      private int encodeTypeSize​(int type, long rawLength)  
      private void flushBlock()  
      (package private) long getCount()  
      private DfsBlock getOrLoadBlock​(long pos)  
      (package private) byte[] inflate​(DfsReader ctx, long pos, int len)  
      (package private) int read​(long pos, byte[] dst, int ptr, int cnt)  
      private int setInput​(long pos, java.util.zip.Inflater inf)  
      private long toBlockStart​(long pos)  
      void write​(byte[] data, int off, int len)  
      void write​(int b)  
      private void writeNoHash​(byte[] data, int off, int len)  
      (package private) byte[] writePackFooter()  
      • Methods inherited from class java.io.OutputStream

        flush, nullOutputStream, write
      • Methods inherited from class java.lang.Object

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

      • md

        private final java.security.MessageDigest md
      • hdrBuf

        final byte[] hdrBuf
      • deflater

        private final java.util.zip.Deflater deflater
      • blockSize

        private final int blockSize
      • currPos

        private long currPos
      • currPtr

        private int currPtr
      • currBuf

        private byte[] currBuf
      • crc32

        final java.util.zip.CRC32 crc32
      • compress

        final java.util.zip.DeflaterOutputStream compress
    • Method Detail

      • getCount

        long getCount()
      • beginObject

        void beginObject​(int objectType,
                         long length)
                  throws java.io.IOException
        Throws:
        java.io.IOException
      • encodeTypeSize

        private int encodeTypeSize​(int type,
                                   long rawLength)
      • write

        public void write​(int b)
                   throws java.io.IOException
        Specified by:
        write in class java.io.OutputStream
        Throws:
        java.io.IOException
      • write

        public void write​(byte[] data,
                          int off,
                          int len)
                   throws java.io.IOException
        Overrides:
        write in class java.io.OutputStream
        Throws:
        java.io.IOException
      • writeNoHash

        private void writeNoHash​(byte[] data,
                                 int off,
                                 int len)
                          throws java.io.IOException
        Throws:
        java.io.IOException
      • flushBlock

        private void flushBlock()
                         throws java.io.IOException
        Throws:
        java.io.IOException
      • copyOf

        private byte[] copyOf​(byte[] src,
                              int ptr,
                              int cnt)
      • writePackFooter

        byte[] writePackFooter()
                        throws java.io.IOException
        Throws:
        java.io.IOException
      • read

        int read​(long pos,
                 byte[] dst,
                 int ptr,
                 int cnt)
          throws java.io.IOException
        Throws:
        java.io.IOException
      • inflate

        byte[] inflate​(DfsReader ctx,
                       long pos,
                       int len)
                throws java.io.IOException,
                       java.util.zip.DataFormatException
        Throws:
        java.io.IOException
        java.util.zip.DataFormatException
      • setInput

        private int setInput​(long pos,
                             java.util.zip.Inflater inf)
                      throws java.io.IOException,
                             java.util.zip.DataFormatException
        Throws:
        java.io.IOException
        java.util.zip.DataFormatException
      • getOrLoadBlock

        private DfsBlock getOrLoadBlock​(long pos)
                                 throws java.io.IOException
        Throws:
        java.io.IOException
      • toBlockStart

        private long toBlockStart​(long pos)
      • close

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