Class RandomAccessFileSP

java.lang.Object
  extended by java.io.RandomAccessFile
      extended by RandomAccessFileSP
All Implemented Interfaces:
Closeable, DataInput, DataOutput

public class RandomAccessFileSP
extends RandomAccessFile


Nested Class Summary
 class RandomAccessFileSP.Offset
           
static class RandomAccessFileSP.Shift
           
 
Field Summary
(package private)  int attemptBufferSize
           
(package private)  long bufferOffset
           
(package private)  int bufferSize
           
(package private)  boolean bufferType
           
(package private)  ByteOrder byteOrder
           
 byte[] fileBuffer
           
(package private)  long fileOffset
           
(package private)  int offsetInBuffer
           
static boolean RANDOMACCESSBUFFER
           
static ByteOrder READER_WRITER_BYTE_ORDER
           
static boolean SETBUFFER
           
 ArrayList<RandomAccessFileSP.Shift> shifts
           
 
Constructor Summary
RandomAccessFileSP(File file, String fileAccess)
           
RandomAccessFileSP(File file, String fileAccess, int bufferSize)
           
 
Method Summary
 void buffer(long offset, int size)
           
 void bufferSeek(int offset)
           
 void bufferSkip(int size)
           
 byte[] correctOrderByteArray(byte[] old)
           
 RandomAccessFileSP.Offset createOffset(long offset)
           
 RandomAccessFileSP.Offset createOffset(long offset, long time)
           
 byte getBuffedByte()
           
 byte getBuffedByte(int offset)
           
 float getBuffedFloat()
           
 float getBuffedFloat(int offset)
           
 int getBuffedInt()
           
 int getBuffedInt(int offset)
           
 long getBuffedLong()
           
 long getBuffedLong(int offset)
           
 short getBuffedShort()
           
 short getBuffedShort(int offset)
           
 String getBuffedString()
           
 String getBuffedString(int offset)
           
 String getBuffedString(int length, boolean reverse)
           
 String getBuffedString(int offset, int length, boolean reverse)
           
 short getBuffedUByte()
           
 short getBuffedUByte(int offset)
           
 long getBuffedUInt()
           
 long getBuffedUInt(int offset)
           
 int getBuffedUShort()
           
 int getBuffedUShort(int offset)
           
 byte getByte()
           
 byte getByte(long offset)
           
 byte[] getBytes(long offset, int amount)
           
 float getFloat()
           
 float getFloat(long offset)
           
 int getInt()
           
 int getInt(long offset)
           
 long getLong()
           
 long getLong(long offset)
           
 short getShort()
           
 short getShort(long offset)
           
 String getString()
           
 String getString(int length, boolean reverse)
           
 String getString(long offset)
           
 String getString(long offset, int length, boolean reverse)
           
 short getUByte()
           
 short getUByte(long offset)
           
 long getUInt()
           
 long getUInt(long offset)
           
 int getUShort()
           
 int getUShort(long offset)
           
 void killBuffer()
           
 void putBuffedByte(byte b)
           
 void putBuffedByte(int offset, byte b)
           
 void putBuffedFloat(float f)
           
 void putBuffedFloat(int offset, float f)
           
 void putBuffedInt(int i)
           
 void putBuffedInt(int offset, int i)
           
 void putBuffedLong(int offset, long l)
           
 void putBuffedLong(long l)
           
 void putBuffedShort(int offset, short s)
           
 void putBuffedShort(short s)
           
 void putBuffedString(int offset, String string)
           
 void putBuffedString(int offset, String string, int length, boolean reverse)
           
 void putBuffedString(String string)
           
 void putBuffedString(String string, int length, boolean reverse)
           
 void putBuffedUByte(int offset, short b)
           
 void putBuffedUByte(short b)
           
 void putBuffedUInt(int offset, long i)
           
 void putBuffedUInt(long i)
           
 void putBuffedUShort(int offset, short s)
           
 void putBuffedUShort(short s)
           
 void putByte(byte b)
           
 void putByte(long offset, byte b)
           
 void putFloat(float f)
           
 void putFloat(long offset, float f)
           
 void putInt(int i)
           
 void putInt(long offset, int i)
           
 void putLong(long l)
           
 void putLong(long offset, long l)
           
 void putShort(long offset, short s)
           
 void putShort(short s)
           
 void putString(long offset, String string)
           
 void putString(long offset, String string, int length, boolean reverse)
           
 void putString(String string)
           
 void putString(String string, int length, boolean reverse)
           
 void putUByte(long offset, short b)
           
 void putUByte(short b)
           
 void putUInt(long i)
           
 void putUInt(long offset, long i)
           
 void putUShort(long offset, short s)
           
 void putUShort(short s)
           
 byte[] readBuffedBytes(int offset, int size)
           
 void seek(long offset)
           
 void setByteOrder(ByteOrder byteOrder)
           
 void shift(long offset, long size)
           
 void writeBuffedBytes(int offset, byte[] data)
           
 void writeBytes(byte[] bytes)
           
 void writeBytes(long offset, byte[] data)
           
 
Methods inherited from class java.io.RandomAccessFile
close, getChannel, getFD, getFilePointer, length, read, read, read, readBoolean, readByte, readChar, readDouble, readFloat, readFully, readFully, readInt, readLine, readLong, readShort, readUnsignedByte, readUnsignedShort, readUTF, setLength, skipBytes, write, write, write, writeBoolean, writeByte, writeBytes, writeChar, writeChars, writeDouble, writeFloat, writeInt, writeLong, writeShort, writeUTF
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

attemptBufferSize

int attemptBufferSize

bufferOffset

long bufferOffset

bufferSize

int bufferSize

bufferType

boolean bufferType

byteOrder

ByteOrder byteOrder

fileBuffer

public byte[] fileBuffer

fileOffset

long fileOffset

offsetInBuffer

int offsetInBuffer

RANDOMACCESSBUFFER

public static final boolean RANDOMACCESSBUFFER
See Also:
Constant Field Values

READER_WRITER_BYTE_ORDER

public static final ByteOrder READER_WRITER_BYTE_ORDER

SETBUFFER

public static final boolean SETBUFFER
See Also:
Constant Field Values

shifts

public ArrayList<RandomAccessFileSP.Shift> shifts
Constructor Detail

RandomAccessFileSP

public RandomAccessFileSP(File file,
                          String fileAccess)
                   throws FileNotFoundException
Throws:
FileNotFoundException

RandomAccessFileSP

public RandomAccessFileSP(File file,
                          String fileAccess,
                          int bufferSize)
                   throws FileNotFoundException
Throws:
FileNotFoundException
Method Detail

buffer

public void buffer(long offset,
                   int size)
            throws IOException
Throws:
IOException

bufferSeek

public void bufferSeek(int offset)

bufferSkip

public void bufferSkip(int size)

correctOrderByteArray

public byte[] correctOrderByteArray(byte[] old)

createOffset

public RandomAccessFileSP.Offset createOffset(long offset)

createOffset

public RandomAccessFileSP.Offset createOffset(long offset,
                                              long time)

getBuffedByte

public byte getBuffedByte()

getBuffedByte

public byte getBuffedByte(int offset)

getBuffedFloat

public float getBuffedFloat()

getBuffedFloat

public float getBuffedFloat(int offset)
                     throws IOException
Throws:
IOException

getBuffedInt

public int getBuffedInt()

getBuffedInt

public int getBuffedInt(int offset)

getBuffedLong

public long getBuffedLong()

getBuffedLong

public long getBuffedLong(int offset)

getBuffedShort

public short getBuffedShort()

getBuffedShort

public short getBuffedShort(int offset)

getBuffedString

public String getBuffedString()

getBuffedString

public String getBuffedString(int offset)

getBuffedString

public String getBuffedString(int length,
                              boolean reverse)

getBuffedString

public String getBuffedString(int offset,
                              int length,
                              boolean reverse)

getBuffedUByte

public short getBuffedUByte()

getBuffedUByte

public short getBuffedUByte(int offset)

getBuffedUInt

public long getBuffedUInt()

getBuffedUInt

public long getBuffedUInt(int offset)

getBuffedUShort

public int getBuffedUShort()

getBuffedUShort

public int getBuffedUShort(int offset)

getByte

public byte getByte()
             throws IOException
Throws:
IOException

getByte

public byte getByte(long offset)
             throws IOException
Throws:
IOException

getBytes

public byte[] getBytes(long offset,
                       int amount)
                throws IOException
Throws:
IOException

getFloat

public float getFloat()
               throws IOException
Throws:
IOException

getFloat

public float getFloat(long offset)
               throws IOException
Throws:
IOException

getInt

public int getInt()
           throws IOException
Throws:
IOException

getInt

public int getInt(long offset)
           throws IOException
Throws:
IOException

getLong

public long getLong()
             throws IOException
Throws:
IOException

getLong

public long getLong(long offset)
             throws IOException
Throws:
IOException

getShort

public short getShort()
               throws IOException
Throws:
IOException

getShort

public short getShort(long offset)
               throws IOException
Throws:
IOException

getString

public String getString()
                 throws IOException
Throws:
IOException

getString

public String getString(int length,
                        boolean reverse)
                 throws IOException
Throws:
IOException

getString

public String getString(long offset)
                 throws IOException
Throws:
IOException

getString

public String getString(long offset,
                        int length,
                        boolean reverse)
                 throws IOException
Throws:
IOException

getUByte

public short getUByte()
               throws IOException
Throws:
IOException

getUByte

public short getUByte(long offset)
               throws IOException
Throws:
IOException

getUInt

public long getUInt()
             throws IOException
Throws:
IOException

getUInt

public long getUInt(long offset)
             throws IOException
Throws:
IOException

getUShort

public int getUShort()
              throws IOException
Throws:
IOException

getUShort

public int getUShort(long offset)
              throws IOException
Throws:
IOException

killBuffer

public void killBuffer()

putBuffedByte

public void putBuffedByte(byte b)

putBuffedByte

public void putBuffedByte(int offset,
                          byte b)

putBuffedFloat

public void putBuffedFloat(float f)

putBuffedFloat

public void putBuffedFloat(int offset,
                           float f)

putBuffedInt

public void putBuffedInt(int i)

putBuffedInt

public void putBuffedInt(int offset,
                         int i)

putBuffedLong

public void putBuffedLong(int offset,
                          long l)

putBuffedLong

public void putBuffedLong(long l)

putBuffedShort

public void putBuffedShort(int offset,
                           short s)

putBuffedShort

public void putBuffedShort(short s)

putBuffedString

public void putBuffedString(int offset,
                            String string)

putBuffedString

public void putBuffedString(int offset,
                            String string,
                            int length,
                            boolean reverse)

putBuffedString

public void putBuffedString(String string)

putBuffedString

public void putBuffedString(String string,
                            int length,
                            boolean reverse)

putBuffedUByte

public void putBuffedUByte(int offset,
                           short b)

putBuffedUByte

public void putBuffedUByte(short b)

putBuffedUInt

public void putBuffedUInt(int offset,
                          long i)

putBuffedUInt

public void putBuffedUInt(long i)

putBuffedUShort

public void putBuffedUShort(int offset,
                            short s)

putBuffedUShort

public void putBuffedUShort(short s)

putByte

public void putByte(byte b)
             throws IOException
Throws:
IOException

putByte

public void putByte(long offset,
                    byte b)
             throws IOException
Throws:
IOException

putFloat

public void putFloat(float f)
              throws IOException
Throws:
IOException

putFloat

public void putFloat(long offset,
                     float f)
              throws IOException
Throws:
IOException

putInt

public void putInt(int i)
            throws IOException
Throws:
IOException

putInt

public void putInt(long offset,
                   int i)
            throws IOException
Throws:
IOException

putLong

public void putLong(long l)
             throws IOException
Throws:
IOException

putLong

public void putLong(long offset,
                    long l)
             throws IOException
Throws:
IOException

putShort

public void putShort(long offset,
                     short s)
              throws IOException
Throws:
IOException

putShort

public void putShort(short s)
              throws IOException
Throws:
IOException

putString

public void putString(long offset,
                      String string)
               throws IOException
Throws:
IOException

putString

public void putString(long offset,
                      String string,
                      int length,
                      boolean reverse)
               throws IOException
Throws:
IOException

putString

public void putString(String string)
               throws IOException
Throws:
IOException

putString

public void putString(String string,
                      int length,
                      boolean reverse)
               throws IOException
Throws:
IOException

putUByte

public void putUByte(long offset,
                     short b)
              throws IOException
Throws:
IOException

putUByte

public void putUByte(short b)
              throws IOException
Throws:
IOException

putUInt

public void putUInt(long i)
             throws IOException
Throws:
IOException

putUInt

public void putUInt(long offset,
                    long i)
             throws IOException
Throws:
IOException

putUShort

public void putUShort(long offset,
                      short s)
               throws IOException
Throws:
IOException

putUShort

public void putUShort(short s)
               throws IOException
Throws:
IOException

readBuffedBytes

public byte[] readBuffedBytes(int offset,
                              int size)

seek

public void seek(long offset)
          throws IOException
Overrides:
seek in class RandomAccessFile
Throws:
IOException

setByteOrder

public void setByteOrder(ByteOrder byteOrder)

shift

public void shift(long offset,
                  long size)
           throws Exception
Throws:
Exception

writeBuffedBytes

public void writeBuffedBytes(int offset,
                             byte[] data)

writeBytes

public void writeBytes(byte[] bytes)
                throws IOException
Throws:
IOException

writeBytes

public void writeBytes(long offset,
                       byte[] data)
                throws IOException
Throws:
IOException