int x = file.read(lengthBuffer, loc); 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); throw new FileException(msg); x = file.read(bb, loc + SizeOfInt); bb.flip(); if ( x != len )
private JournalEntry _read() int lenRead = channel.read(header) ; if ( lenRead == -1 ) lenRead = channel.read(bb) ; if ( lenRead != len) throw new TDBTransactionException("Failed to read the journal entry: wanted "+len+" bytes, got "+lenRead) ; lenRead = channel.read(crcTrailer) ; if ( lenRead != SizeofCRC ) throw new TDBTransactionException("Failed to read block checksum (got "+lenRead+" bytes, not "+SizeofCRC+").") ;
@Test public void storage_05() { ByteBuffer b1 = data(blkSize) ; ByteBuffer b1a = ByteBuffer.allocate(blkSize) ; ByteBuffer b2 = data(blkSize/2) ; ByteBuffer b2a = ByteBuffer.allocate(blkSize/2) ; store.write(b1) ; store.write(b2) ; store.position(0) ; store.read(b1a) ; assertTrue(same(b1, b1a)) ; store.read(b2a) ; assertTrue(same(b2, b2a)) ; }
@Test public void storage_05() { ByteBuffer b1 = data(blkSize) ; ByteBuffer b1a = ByteBuffer.allocate(blkSize) ; ByteBuffer b2 = data(blkSize/2) ; ByteBuffer b2a = ByteBuffer.allocate(blkSize/2) ; store.write(b1) ; store.write(b2) ; store.position(0) ; store.read(b1a) ; assertTrue(same(b1, b1a)) ; store.read(b2a) ; assertTrue(same(b2, b2a)) ; }
@Test public void storage_03() { ByteBuffer b1 = data(blkSize) ; long posn = store.position() ; store.write(b1) ; ByteBuffer b9 = ByteBuffer.allocate(blkSize) ; int r = store.read(b9, posn) ; assertEquals(blkSize, r) ; assertTrue(same(b1, b9)) ; }
@Test public void storage_03() { ByteBuffer b1 = data(blkSize) ; long posn = store.position() ; store.write(b1) ; ByteBuffer b9 = ByteBuffer.allocate(blkSize) ; int r = store.read(b9, posn) ; assertEquals(blkSize, r) ; assertTrue(same(b1, b9)) ; }
@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_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) ; }