6768697071727374757677
/// second state removes 3, 7, 10 and adds 11, 12 addFs(1, 2, 4, 5, 6, 8, 9, 11, 12); stateEngine.prepareForWrite(); writer.writeDelta(baos); delta = baos.toByteArray(); baos.reset(); writer.writeSnapshot(baos); snapshot2 = baos.toByteArray();
178179180181182183184185186187188
ByteArrayOutputStream baos = new ByteArrayOutputStream(); DataOutputStream outputStream = new DataOutputStream(baos); try { /// This time write the delta file. writer.writeDelta(outputStream); } catch(IOException e) { /// thrown if the FastBlobWriter was unable to write to the provided stream. } finally { try { outputStream.close();
717718719720721722723724725726727
break; case GAMMA: bitCount = out.writeGamma( pointer - lastDocument - 1 ); break; case DELTA: bitCount = out.writeDelta( pointer - lastDocument - 1 ); break; case GOLOMB: bitCount = out.writeGolomb( pointer - lastDocument - 1, b, log2b ); break; default:
792793794795796797798799800801802
bitCount += positions.writeGamma( occ[ i ] - prev - 1 ); prev = occ[ i ]; } break; case DELTA: if ( COOKIES ) bitCount += positions.writeDelta( Integer.MAX_VALUE ); for( i = offset; i < end; i++ ) { bitCount += positions.writeDelta( occ[ i ] - prev - 1 ); prev = occ[ i ]; } break;
794795796797798799800801802803804
} break; case DELTA: if ( COOKIES ) bitCount += positions.writeDelta( Integer.MAX_VALUE ); for( i = offset; i < end; i++ ) { bitCount += positions.writeDelta( occ[ i ] - prev - 1 ); prev = occ[ i ]; } break; case SHIFTED_GAMMA: if ( COOKIES ) bitCount += positions.writeShiftedGamma( Integer.MAX_VALUE );
605606607608609610611612613614615
SimpleCompressedDocumentCollectionBuilder.writeSelfDelimitedUtf8String( newDocumentsObs, s ); readSelfDelimitedUtf8String( documentsIbs, s ); // Skip title SimpleCompressedDocumentCollectionBuilder.writeSelfDelimitedUtf8String( newDocumentsObs, s ); for( int f = factory.numberOfFields() - 1; f-- !=0; ) { int len = documentsIbs.readDelta(); newDocumentsObs.writeDelta( len ); while( len-- != 0 ) { newDocumentsObs.writeDelta( invTermPerm[ documentsIbs.readDelta() ] ); if ( exact ) newDocumentsObs.writeDelta( invNonTermPerm[ documentsIbs.readDelta() ] ); } }
607608609610611612613614615616617
SimpleCompressedDocumentCollectionBuilder.writeSelfDelimitedUtf8String( newDocumentsObs, s ); for( int f = factory.numberOfFields() - 1; f-- !=0; ) { int len = documentsIbs.readDelta(); newDocumentsObs.writeDelta( len ); while( len-- != 0 ) { newDocumentsObs.writeDelta( invTermPerm[ documentsIbs.readDelta() ] ); if ( exact ) newDocumentsObs.writeDelta( invNonTermPerm[ documentsIbs.readDelta() ] ); } } } newDocumentsObs.close();
608609610611612613614615616617618
for( int f = factory.numberOfFields() - 1; f-- !=0; ) { int len = documentsIbs.readDelta(); newDocumentsObs.writeDelta( len ); while( len-- != 0 ) { newDocumentsObs.writeDelta( invTermPerm[ documentsIbs.readDelta() ] ); if ( exact ) newDocumentsObs.writeDelta( invNonTermPerm[ documentsIbs.readDelta() ] ); } } } newDocumentsObs.close(); new File( basename + DOCUMENTS_EXTENSION ).delete();