public byte [ ] getKeySetToByteArray ( ) { ByteArrayOutputStream baos = new ByteArrayOutputStream ( ) ; DataOutputStream dos = new DataOutputStream ( baos ) ; char [ ] buffer = new char [ getMaxFieldLenth ( ) ] ; try { for ( String s : keys ) { Arrays . fill ( buffer , ( char ) 0 ) ; System . arraycopy ( s . toCharArray ( ) , 0 , buffer , 0 , s . length ( ) ) ; dos . writeBytes ( new String ( buffer ) ) ; } } catch ( IOException e ) { System . err . println ( "Could not write Structure key set to byte array: " + e ) ; return new byte [ 0 ] ; } return baos . toByteArray ( ) ; }
Dumps field names to byte array . Field names are written as Zero End Strings