Class SuRandomAccessFile

java.lang.Object
com.topjohnwu.superuser.io.SuRandomAccessFile
All Implemented Interfaces:
Closeable, DataInput, DataOutput, AutoCloseable

public abstract class SuRandomAccessFile extends Object 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 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.

See Also: