2019-03-07 16:19:53 +01:00
|
|
|
package it.cavallium.strangedb.database;
|
|
|
|
|
|
|
|
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
|
|
|
|
*/
|
2019-04-20 15:54:40 +02:00
|
|
|
int writeAt(long index, int length, ByteBuffer data) throws IOException;
|
2019-03-07 16:19:53 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* 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;
|
|
|
|
}
|