public void writeIntern (String value)
        throws IOException
    {
        // if the value to be written is null, simply write a zero
        if (value == null) {
            writeShort(0);
            return;
        }

        // create our intern map if necessary
        if (_internmap == null) {
            _internmap = Maps.newHashMap();
        }

        // look up the intern mapping record
        Short code = _internmap.get(value);

        // create a mapping for the value if we've not got one
        if (code == null) {
            if (ObjectInputStream.STREAM_DEBUG) {
                log.info(hashCode() + ": Creating intern mapping", "code", _nextInternCode,
                         "value", value);
            }
            code = createInternMapping(_nextInternCode++);
            _internmap.put(value.intern(), code);

            // make sure we didn't blow past our maximum intern count
            if (_nextInternCode <= 0) {
                throw new RuntimeException("Too many unique interns written to ObjectOutputStream");
            }
            writeNewInternMapping(code, value);

        } else {
            writeExistingInternMapping(code, value);
        }
    }
public void writeIntern ( String value ) throws IOException { if ( value == null ) { writeShort ( 0 ) ; return ; } if ( _internmap == null ) { _internmap = Maps . newHashMap ( ) ; } Short code = _internmap . get ( value ) ; if ( code == null ) { if ( ObjectInputStream . STREAM_DEBUG ) { log . info ( hashCode ( ) + ": Creating intern mapping" , "code" , _nextInternCode , "value" , value ) ; } code = createInternMapping ( _nextInternCode ++ ) ; _internmap . put ( value . intern ( ) , code ) ; if ( _nextInternCode <= 0 ) { throw new RuntimeException ( "Too many unique interns written to ObjectOutputStream" ) ; } writeNewInternMapping ( code , value ) ; } else { writeExistingInternMapping ( code , value ) ; } }
Writes a pooled string value to the output stream.