use of org.apache.jena.tdb.base.block.Block in project jena by apache.
the class AbstractTestBlockAccessFixedSize method fileaccess_02.
@Test
public void fileaccess_02() {
Block b = data(file, blkSize);
file.write(b);
}
use of org.apache.jena.tdb.base.block.Block in project jena by apache.
the class AbstractTestObjectFile method objectfile_02.
@Test
public void objectfile_02() {
Block block = file.allocWrite(10);
fill(block.getByteBuffer());
file.completeWrite(block);
long x1 = block.getId();
assertEquals(0, x1);
ByteBuffer bb = file.read(x1);
// position
assertTrue(sameValue(block.getByteBuffer(), bb));
}
use of org.apache.jena.tdb.base.block.Block in project jena by apache.
the class BlockAccessByteArray method allocate.
@Override
public Block allocate(int size) {
long addr = alloc;
ByteBuffer bb = ByteBuffer.allocate(size);
alloc += (size + SizeOfInt);
return new Block((int) addr, bb);
}
use of org.apache.jena.tdb.base.block.Block in project jena by apache.
the class BlockAccessByteArray method read.
@Override
public Block read(long id) {
// Variable length blocks.
if (id < 0 || id >= length || id >= bytes.capacity())
throw new FileException("Bad id (read): " + id);
bytes.position((int) id);
int len = bytes.getInt();
ByteBuffer bb = ByteBuffer.allocate(len);
// Copy out the bytes - copy for safety.
bytes.get(bb.array(), 0, len);
return new Block(id, bb);
}
use of org.apache.jena.tdb.base.block.Block in project jena by apache.
the class BlockAccessMapped method read.
@Override
public Block read(long id) {
check(id);
checkIfClosed();
ByteBuffer bb = getByteBuffer(id);
bb.position(0);
Block block = new Block(id, bb);
return block;
}
Aggregations