Class NumberedSplitRandomAccessFile

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

    public class NumberedSplitRandomAccessFile
    extends java.io.RandomAccessFile
    A RandomAccessFile which reads files split with 7-zip format (.z001, .z002, etc) as a single file making it easier for calling methods to deal with opening appropriate split file to read
    • Field Detail

      • splitLength

        private long splitLength
      • allSortedSplitFiles

        private java.io.File[] allSortedSplitFiles
      • randomAccessFile

        private java.io.RandomAccessFile randomAccessFile
      • singleByteBuffer

        private byte[] singleByteBuffer
      • currentOpenSplitFileCounter

        private int currentOpenSplitFileCounter
      • rwMode

        private java.lang.String rwMode
    • Constructor Detail

      • NumberedSplitRandomAccessFile

        public NumberedSplitRandomAccessFile​(java.lang.String name,
                                             java.lang.String mode)
                                      throws java.io.IOException
        Throws:
        java.io.IOException
      • NumberedSplitRandomAccessFile

        public NumberedSplitRandomAccessFile​(java.io.File file,
                                             java.lang.String mode)
                                      throws java.io.IOException
        Throws:
        java.io.IOException
      • NumberedSplitRandomAccessFile

        public NumberedSplitRandomAccessFile​(java.io.File file,
                                             java.lang.String mode,
                                             java.io.File[] allSortedSplitFiles)
                                      throws java.io.IOException
        Throws:
        java.io.IOException
    • Method Detail

      • read

        public int read()
                 throws java.io.IOException
        Overrides:
        read in class java.io.RandomAccessFile
        Throws:
        java.io.IOException
      • read

        public int read​(byte[] b)
                 throws java.io.IOException
        Overrides:
        read in class java.io.RandomAccessFile
        Throws:
        java.io.IOException
      • read

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

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

        public void write​(byte[] b)
                   throws java.io.IOException
        Specified by:
        write in interface java.io.DataOutput
        Overrides:
        write in class java.io.RandomAccessFile
        Throws:
        java.io.IOException
      • write

        public void write​(byte[] b,
                          int off,
                          int len)
                   throws java.io.IOException
        Specified by:
        write in interface java.io.DataOutput
        Overrides:
        write in class java.io.RandomAccessFile
        Throws:
        java.io.IOException
      • seek

        public void seek​(long pos)
                  throws java.io.IOException
        Overrides:
        seek in class java.io.RandomAccessFile
        Throws:
        java.io.IOException
      • getFilePointer

        public long getFilePointer()
                            throws java.io.IOException
        Overrides:
        getFilePointer in class java.io.RandomAccessFile
        Throws:
        java.io.IOException
      • length

        public long length()
                    throws java.io.IOException
        Overrides:
        length in class java.io.RandomAccessFile
        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.RandomAccessFile
        Throws:
        java.io.IOException
      • seekInCurrentPart

        public void seekInCurrentPart​(long pos)
                               throws java.io.IOException
        Throws:
        java.io.IOException
      • openLastSplitFileForReading

        public void openLastSplitFileForReading()
                                         throws java.io.IOException
        Throws:
        java.io.IOException
      • openRandomAccessFileForIndex

        private void openRandomAccessFileForIndex​(int splitCounter)
                                           throws java.io.IOException
        Throws:
        java.io.IOException
      • assertAllSplitFilesExist

        private void assertAllSplitFilesExist​(java.io.File[] allSortedSplitFiles)
                                       throws java.io.IOException
        Throws:
        java.io.IOException