Class SplitOutputStream

    • Field Detail

      • raf

        private java.io.RandomAccessFile raf
      • splitLength

        private long splitLength
      • zipFile

        private java.io.File zipFile
      • currSplitFileCounter

        private int currSplitFileCounter
      • bytesWrittenForThisPart

        private long bytesWrittenForThisPart
      • rawIO

        private RawIO rawIO
    • Constructor Detail

      • SplitOutputStream

        public SplitOutputStream​(java.io.File file)
                          throws java.io.FileNotFoundException,
                                 ZipException
        Throws:
        java.io.FileNotFoundException
        ZipException
      • SplitOutputStream

        public SplitOutputStream​(java.io.File file,
                                 long splitLength)
                          throws java.io.FileNotFoundException,
                                 ZipException
        Throws:
        java.io.FileNotFoundException
        ZipException
    • Method Detail

      • 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[] b)
                   throws java.io.IOException
        Overrides:
        write in class java.io.OutputStream
        Throws:
        java.io.IOException
      • write

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

        private void startNextSplitFile()
                                 throws java.io.IOException
        Throws:
        java.io.IOException
      • isHeaderData

        private boolean isHeaderData​(byte[] buff)
      • checkBufferSizeAndStartNextSplitFile

        public boolean checkBufferSizeAndStartNextSplitFile​(int bufferSize)
                                                     throws ZipException
        Checks if the buffer size is sufficient for the current split file. If not a new split file will be started.
        Parameters:
        bufferSize -
        Returns:
        true if a new split file was started else false
        Throws:
        ZipException
      • isBufferSizeFitForCurrSplitFile

        private boolean isBufferSizeFitForCurrSplitFile​(int bufferSize)
        Checks if the given buffer size will be fit in the current split file. If this output stream is a non-split file, then this method always returns true
        Parameters:
        bufferSize -
        Returns:
        true if the buffer size is fit in the current split file or else false.
      • seek

        public void seek​(long pos)
                  throws java.io.IOException
        Throws:
        java.io.IOException
      • skipBytes

        public int skipBytes​(int n)
                      throws java.io.IOException
        Throws:
        java.io.IOException
      • 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
      • isSplitZipFile

        public boolean isSplitZipFile()
      • getSplitLength

        public long getSplitLength()