Class RandomAccessFileData
- java.lang.Object
-
- org.hansken.plugin.extraction.test.serialize.RandomAccessFileData
-
- All Implemented Interfaces:
Closeable,AutoCloseable,RandomAccessData
public class RandomAccessFileData extends Object implements RandomAccessData
ARandomAccessDataimplementation which reads from an in-memory byte array. Closing it has the effect of removing the reference to the array.Note: this implementation is not thread-safe.
-
-
Constructor Summary
Constructors Constructor Description RandomAccessFileData(File file)Create a new instance reading from given file.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()longposition()intread(byte[] buffer, int offset, int count)voidseek(long position)longsize()-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.hansken.plugin.extraction.api.RandomAccessData
read, read, readNBytes, remaining
-
-
-
-
Constructor Detail
-
RandomAccessFileData
public RandomAccessFileData(File file) throws FileNotFoundException
Create a new instance reading from given file.- Parameters:
file- the file to read data from- Throws:
FileNotFoundException- if the file does not exist
-
-
Method Detail
-
close
public void close() throws IOException- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-
size
public long size()
- Specified by:
sizein interfaceRandomAccessData
-
position
public long position()
- Specified by:
positionin interfaceRandomAccessData
-
seek
public void seek(long position) throws IOException- Specified by:
seekin interfaceRandomAccessData- Throws:
IOException
-
read
public int read(byte[] buffer, int offset, int count) throws IOException- Specified by:
readin interfaceRandomAccessData- Throws:
IOException
-
-