public String readIntern ( ) throws IOException { // create our intern map if necessary if ( _internmap == null ) { _internmap = Lists . newArrayList ( ) ; // insert a zeroth element _internmap . add ( null ) ; } // read in the intern code for this instance short code = readShort ( ) ; // a zero code indicates a null value if ( code == 0 ) { return null ; // if the code is negative, that means that we've never seen if before and value follows } else if ( code < 0 ) { // first swap the code into positive-land code *= - 1 ; // read in the value String value = readUTF ( ) . intern ( ) ; // create the mapping and return the value mapIntern ( code , value ) ; return value ; } else { String value = ( code < _internmap . size ( ) ) ? _internmap . get ( code ) : null ; // sanity check if ( value == null ) { // this will help with debugging log . warning ( "Internal stream error, no intern value" , "code" , code , "ois" , this , new Exception ( ) ) ; log . warning ( "ObjectInputStream mappings" , "map" , _internmap ) ; String errmsg = "Read intern code for which we have no registered value " + "metadata [code=" + code + "]" ; throw new RuntimeException ( errmsg ) ; } return value ; } }
Reads a pooled string value from the input stream .