cdrBufOutput output, int level)
BufferedCdrOutput output, int level)
  public static int readNestedValue(int value_tag, InputStream input,    cdrBufOutput output, int level)    throws IOException  {    String id = null;    if (level < -1)      {        // For the first level, this information is already behind.        output.write_long(value_tag - vf_CHUNKING);        // The nested value should be aways chunked.        if ((value_tag & vf_CHUNKING) == 0)                  {            MARSHAL m = new MARSHAL("readNestedValue: must be chunked");            m.minor = Minor.Chunks;            throw m;                  }        else if (value_tag == vt_NULL)          {            MARSHAL m = new MARSHAL("readNestedValue: nul");            m.minor = Minor.Chunks;            throw m;              }        else if (value_tag == vt_INDIRECTION)              {            MARSHAL m = new MARSHAL("readNestedValue: indirection");            m.minor = Minor.Chunks;            throw m;              }            else              {            // Read the value.            if ((value_tag & vf_CODEBASE) != 0)              {                String codebase = read_string(input);                write_string(output, codebase);              }            if ((value_tag & vf_MULTIPLE_IDS) != 0)              {                // Multiple supported repository ids are present.                String[] ids = read_string_array(input);                id = ids[0];                write_string_array(output, ids);          }            else if ((value_tag & vf_ID) != 0)          {                id = read_string(input);                write_string(output, id);              }          }      }    int n = -1;    // Read all chunks.    int chunk_size;    byte[] r = null;    while (true)              {        // Read the size of the next chunk or it may also be the        // header of the nested value.        chunk_size = input.read_long();        // End of chunk terminator.        if (chunk_size < 0 && chunk_size >= level)          return chunk_size;        else if (chunk_size >= 0x7FFFFF00)          {            int onInput = getCurrentPosition(input) - 4;            int onOutput = output.getPosition();            output.getRunTime().redirect(onInput, onOutput);            // Value over 0x7FFFFF00 indicates that the nested value            // starts here. Read the nested value, storing it into the output.            // First parameter is actually the value tag.            chunk_size = readNestedValue(chunk_size, input, output, level - 1);            if (chunk_size < 0 && chunk_size >= level)              return chunk_size;              }            else              {            // The chunk follows.            if (r == null || r.length < chunk_size)              r = new byte[chunk_size + 256];            n = 0;            reading: while (n < chunk_size)              n += input.read(r, n, chunk_size - n);            output.write(r, 0, n);              }          }      }