throws IOException,
RSException,
SerializationException
{
System.out.println( "Writing index" );
final ZOutputStream zos = new ZOutputStream(
os,
ZStream.Z_BEST_COMPRESSION
);
final SerializerOutputStream out = new SerializerOutputStream( zos );
final int numRecords;
try
{
index.getRecordStore().open();
}
catch( RecordStoreFullException e )
{
throw new RSException( 0, e );
}
final Store rs = index.getRecordStore();
out.writeInt( index.getOrder() );
out.writeByte( (byte) index.getType() );
out.writeBoolean( index.isCaseSensitive() );
numRecords = rs.getNumRecords();
System.out.println( "Writing " + numRecords + " records" );
out.writeInt( numRecords );
for( int i = 1; i <= numRecords; i++ )
{
try
{
out.writeBlob( rs.getRecord( i ) );
}
catch( InvalidRecordIDException e )
{
}
}
out.flush();
zos.flush();
zos.close();
System.out.println( "Done" );
}