protected int serializeHeader ( DataOutputStream dos ) throws IOException { // Write the header. It is already set and ready to use, having been // created when the Trie2 was unserialized or when it was frozen. int bytesWritten = 0 ; dos . writeInt ( header . signature ) ; dos . writeShort ( header . options ) ; dos . writeShort ( header . indexLength ) ; dos . writeShort ( header . shiftedDataLength ) ; dos . writeShort ( header . index2NullOffset ) ; dos . writeShort ( header . dataNullOffset ) ; dos . writeShort ( header . shiftedHighStart ) ; bytesWritten += 16 ; // Write the index int i ; for ( i = 0 ; i < header . indexLength ; i ++ ) { dos . writeChar ( index [ i ] ) ; } bytesWritten += header . indexLength ; return bytesWritten ; }
Serialize a trie2 Header and Index onto an OutputStream . This is common code used for both the Trie2_16 and Trie2_32 serialize functions .