public IteratorEntries(long startPosition) { iterPosn = startPosition ; endPoint = channel.size() ; }
public long size() { return channel.size() ; }
public boolean isEmpty() { return channel.size() == 0 ; }
private String state() { if ( writeBuffer == null ) return String.format(getLabel() + ": filesize=0x%X, file=(0x%X, 0x%X)", filesize, file.position(), file.size()); else return String.format(getLabel() + ": filesize=0x%X, file=(0x%X, 0x%X), writeBuffer=(0x%X,0x%X)", filesize, file.position(), file.size(), writeBuffer.position(), writeBuffer.limit()); }
public ObjectFileStorage(BufferChannel file, int bufferSize) { this.file = file; filesize = file.size(); this.file.position(filesize); // End of file. log("File size: 0x%X, posn: 0x%X", filesize, file.position()); writeBuffer = (bufferSize >= 0) ? ByteBuffer.allocate(bufferSize) : null; }
if ( x != 4 ) { String msg = "ObjectFileStorage.read[" + file.getLabel() + "](" + loc + ")[filesize=" + filesize + "]" + "[file.size()=" + file.size() + "]: Failed to read the length : got " + x + " bytes"; lengthBuffer.clear(); int x1 = file.read(lengthBuffer, loc); + file.size() + "]: Impossibly large object : " + len + " bytes > filesize-(loc+SizeOfInt)=" + (filesize - (loc + SizeOfInt)); throw new FileException(msg);
@Test public void storage_01() { assertEquals(0, store.size()) ; }
@Test public void storage_01() { assertEquals(0, store.size()) ; }
@Test public void storage_02() { ByteBuffer b = data(blkSize) ; store.write(b) ; long x = store.size() ; assertEquals(blkSize, x) ; }
@Test public void storage_02() { ByteBuffer b = data(blkSize) ; store.write(b) ; long x = store.size() ; assertEquals(blkSize, x) ; }
@Test public void storage_07() { ByteBuffer b1 = data(blkSize) ; store.write(b1) ; store.position(10) ; b1.rewind() ; store.write(b1) ; assertEquals(blkSize+10, store.size()) ; }
@Test public void storage_07() { ByteBuffer b1 = data(blkSize) ; store.write(b1) ; store.position(10) ; b1.rewind() ; store.write(b1) ; assertEquals(blkSize+10, store.size()) ; }
@Test public void storage_08() { ByteBuffer b1 = data(blkSize) ; ByteBuffer b2 = data(blkSize) ; store.write(b1) ; store.write(b2) ; store.position(10) ; b1.rewind() ; store.write(b1) ; assertEquals(2*blkSize, store.size()) ; }
@Test public void storage_04() { ByteBuffer b1 = data(blkSize) ; ByteBuffer b2 = data(blkSize/2) ; store.write(b2, 0) ; store.write(b1, 0) ; assertEquals(blkSize, store.size()) ; ByteBuffer b9 = ByteBuffer.allocate(5) ; int z = store.read(b9) ; assertEquals(5, z) ; }
@Test public void storage_08() { ByteBuffer b1 = data(blkSize) ; ByteBuffer b2 = data(blkSize) ; store.write(b1) ; store.write(b2) ; store.position(10) ; b1.rewind() ; store.write(b1) ; assertEquals(2*blkSize, store.size()) ; }
@Test public void storage_04() { ByteBuffer b1 = data(blkSize) ; ByteBuffer b2 = data(blkSize/2) ; store.write(b2, 0) ; store.write(b1, 0) ; assertEquals(blkSize, store.size()) ; ByteBuffer b9 = ByteBuffer.allocate(5) ; int z = store.read(b9) ; assertEquals(5, z) ; }
@Test public void storage_06() { ByteBuffer b1 = data(blkSize) ; store.write(b1) ; store.truncate(0) ; assertEquals(0, store.size()) ; // Check for: // http://bugs.sun.com/view_bug.do?bug_id=6191269 assertEquals(0, store.position()) ; }
@Test public void storage_06() { ByteBuffer b1 = data(blkSize) ; store.write(b1) ; store.truncate(0) ; assertEquals(0, store.size()) ; // Check for: // http://bugs.sun.com/view_bug.do?bug_id=6191269 assertEquals(0, store.position()) ; }