2019-03-07 11:41:45 +01:00
|
|
|
package it.cavallium.strangedb.database;
|
2019-01-31 20:05:23 +01:00
|
|
|
|
|
|
|
import java.io.*;
|
|
|
|
import java.nio.ByteBuffer;
|
|
|
|
|
|
|
|
public interface IFileIO {
|
|
|
|
/**
|
|
|
|
* Read *length* bytes in position *index*
|
|
|
|
* @param index index
|
|
|
|
* @param length length
|
|
|
|
* @return bytes
|
|
|
|
*/
|
|
|
|
ByteBuffer readAt(long index, int length) throws IOException;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Write *length* bytes in position *index*
|
|
|
|
* @param index index
|
|
|
|
* @param length length
|
|
|
|
* @param data bytes
|
|
|
|
*/
|
|
|
|
void writeAt(long index, int length, ByteBuffer data) throws IOException;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Write *length* bytes in position *index*
|
|
|
|
* @param length length
|
|
|
|
* @param data bytes
|
|
|
|
* @return index
|
|
|
|
*/
|
|
|
|
long writeAtEnd(int length, ByteBuffer data) throws IOException;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Close the file
|
|
|
|
*/
|
|
|
|
void close() throws IOException;
|
|
|
|
}
|