java.io.Closeable
, java.lang.AutoCloseable
public class BlockFile
extends java.lang.Object
implements java.io.Closeable
修飾子とタイプ | フィールド | 説明 |
---|---|---|
RandomAccessInterface |
file |
|
Log |
log |
|
static int |
MAGIC_CONT |
|
static int |
METAINDEX_PAGE |
|
static long |
OFFSET_MOUNTED |
|
static int |
PAGESIZE |
|
int |
spanSize |
コンストラクタ | 説明 |
---|---|
BlockFile(java.io.File f,
boolean init) |
File must be writable
|
BlockFile(java.io.RandomAccessFile raf) |
RAF must be writable
|
BlockFile(java.io.RandomAccessFile raf,
boolean init) |
RAF must be writable
|
BlockFile(RandomAccessInterface rai) |
Use this constructor with a readonly RAI for a readonly blockfile
|
BlockFile(RandomAccessInterface rai,
boolean init) |
Use this constructor with a readonly RAI and init = false for a readonly blockfile
|
修飾子とタイプ | メソッド | 説明 |
---|---|---|
int |
allocPage() |
|
boolean |
bfck(boolean fix) |
Run an integrity check on the blockfile and all the skiplists in it
|
void |
close() |
Closes all open skiplists and then the blockfile itself.
|
void |
closeIndex(java.lang.String name) |
Close a skiplist if it is open.
|
void |
delIndex(java.lang.String name) |
Delete a skiplist if it exists.
|
void |
freePage(int page) |
Add the page to the free list.
|
<K extends java.lang.Comparable<? super K>,V> |
getIndex(java.lang.String name,
Serializer<K> key,
Serializer<V> val) |
Open a skiplist if it exists.
|
static void |
main(java.lang.String[] args) |
Run an integrity check on the blockfile and all the skiplists in it.
|
<K extends java.lang.Comparable<? super K>,V> |
makeIndex(java.lang.String name,
Serializer<K> key,
Serializer<V> val) |
Create and open a new skiplist if it does not exist.
|
static void |
pageSeek(RandomAccessInterface file,
int page) |
Go to any page but the superblock.
|
int |
readMultiPageData(byte[] arr,
int page,
int[] curPageOff,
int[] nextPage) |
Read bytes
|
<K extends java.lang.Comparable<? super K>,V> |
reformatIndex(java.lang.String name,
Serializer<K> oldKey,
Serializer<V> oldVal,
Serializer<K> newKey,
Serializer<V> newVal) |
Reformat a skiplist with new Serializers if it exists.
|
int |
skipMultiPageBytes(int length,
int page,
int[] curPageOff,
int[] nextPage) |
Skip length bytes
The same as readMultiPageData() without returning a result
|
boolean |
wasMounted() |
I2P was the file locked when we opened it?
|
int |
writeMultiPageData(byte[] data,
int page,
int[] curPageOff,
int[] nextPage) |
Write bytes
This will allocate additional continuation pages as necessary.
|
public static final int PAGESIZE
public static final long OFFSET_MOUNTED
public final Log log
public final RandomAccessInterface file
public static final int MAGIC_CONT
public static final int METAINDEX_PAGE
public int spanSize
public BlockFile(RandomAccessInterface rai) throws java.io.IOException
java.io.IOException
public BlockFile(java.io.RandomAccessFile raf) throws java.io.IOException
java.io.IOException
public BlockFile(java.io.RandomAccessFile raf, boolean init) throws java.io.IOException
java.io.IOException
public BlockFile(java.io.File f, boolean init) throws java.io.IOException
java.io.IOException
public BlockFile(RandomAccessInterface rai, boolean init) throws java.io.IOException
java.io.IOException
public static void main(java.lang.String[] args)
public int writeMultiPageData(byte[] data, int page, int[] curPageOff, int[] nextPage) throws java.io.IOException
data
- data to writepage
- current pagecurPageOff
- in (current) and out (new) parameter at index 0nextPage
- in (current) and out (new) parameter at index 0java.io.IOException
public int readMultiPageData(byte[] arr, int page, int[] curPageOff, int[] nextPage) throws java.io.IOException
arr
- fill this array fully with datapage
- current pagecurPageOff
- in (current) and out (new) parameter at index 0nextPage
- in (current) and out (new) parameter at index 0java.io.IOException
public int skipMultiPageBytes(int length, int page, int[] curPageOff, int[] nextPage) throws java.io.IOException
length
- number of bytes to skippage
- current pagecurPageOff
- in (current) and out (new) parameter at index 0nextPage
- in (current) and out (new) parameter at index 0java.io.IOException
public boolean wasMounted()
public static void pageSeek(RandomAccessInterface file, int page) throws java.io.IOException
page
- >= 2java.io.IOException
public int allocPage() throws java.io.IOException
java.io.IOException
public void freePage(int page)
public <K extends java.lang.Comparable<? super K>,V> BSkipList<K,V> getIndex(java.lang.String name, Serializer<K> key, Serializer<V> val) throws java.io.IOException
java.io.IOException
public <K extends java.lang.Comparable<? super K>,V> BSkipList<K,V> makeIndex(java.lang.String name, Serializer<K> key, Serializer<V> val) throws java.io.IOException
java.io.IOException
- if already exists or other errorspublic void delIndex(java.lang.String name) throws java.io.IOException
java.io.IOException
- if it is closed.public void closeIndex(java.lang.String name)
public <K extends java.lang.Comparable<? super K>,V> void reformatIndex(java.lang.String name, Serializer<K> oldKey, Serializer<V> oldVal, Serializer<K> newKey, Serializer<V> newVal) throws java.io.IOException
java.io.IOException
- if it is open or on errorspublic void close() throws java.io.IOException
close
インタフェース内 java.lang.AutoCloseable
close
インタフェース内 java.io.Closeable
java.io.IOException
public boolean bfck(boolean fix)