private static void writeOriginField ( DataOutput out , SerializedField code , Object v ) throws IOException { switch ( code ) { case ORIGIN_DESCRIPTION : out . writeUTF ( ( String ) v ) ; break ; case ORIGIN_LINE_NUMBER : out . writeInt ( ( Integer ) v ) ; break ; case ORIGIN_END_LINE_NUMBER : out . writeInt ( ( Integer ) v ) ; break ; case ORIGIN_TYPE : out . writeByte ( ( Integer ) v ) ; break ; case ORIGIN_URL : out . writeUTF ( ( String ) v ) ; break ; case ORIGIN_RESOURCE : out . writeUTF ( ( String ) v ) ; break ; case ORIGIN_COMMENTS : @ SuppressWarnings ( "unchecked" ) List < String > list = ( List < String > ) v ; int size = list . size ( ) ; out . writeInt ( size ) ; for ( String s : list ) { out . writeUTF ( s ) ; } break ; case ORIGIN_NULL_URL : // FALL THRU case ORIGIN_NULL_RESOURCE : // FALL THRU case ORIGIN_NULL_COMMENTS : // nothing to write out besides code and length break ; default : throw new IOException ( "Unhandled field from origin: " + code ) ; } }
outer stream instead of field . data