Package 

Class SuRandomAccessFile

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

    
    public abstract class SuRandomAccessFile
     implements DataInput, DataOutput, Closeable
                        

    Access files using the main shell and mimics RandomAccessFile.

    Usage of this class is not recommended. Each I/O operation comes with a large overhead and depends on certain behavior of the command {@code dd}. Writing to files through shell commands is proven to be error prone. YOU HAVE BEEN WARNED!Please use SuFileInputStream and SuFileOutputStream whenever possible.

    This class always checks whether using a shell is necessary. If not, it simply opens a new RandomAccessFile and behaves as a wrapper. This class has almost the exact same methods as RandomAccessFile and can be treated as a drop-in replacement.

    • Method Summary

      Modifier and Type Method Description
      static SuRandomAccessFile open(@NonNull() File file, String mode)
      static SuRandomAccessFile open(@NonNull() String path, String mode) {@code SuRandomAccessFile.open(new File(path), mode)}
      abstract int read()
      abstract int read(Array<byte> b)
      abstract int read(Array<byte> b, int off, int len)
      abstract void seek(long pos)
      abstract void setLength(long newLength)
      abstract long length()
      abstract long getFilePointer()
      • Methods inherited from class java.io.DataInput

        readBoolean, readByte, readChar, readDouble, readFloat, readFully, readInt, readLine, readLong, readShort, readUTF, readUnsignedByte, readUnsignedShort, skipBytes
      • Methods inherited from class java.io.DataOutput

        write, writeBoolean, writeByte, writeBytes, writeChar, writeChars, writeDouble, writeFloat, writeInt, writeLong, writeShort, writeUTF
      • Methods inherited from class java.io.Closeable

        close
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait