/[classpath]/classpath/gnu/CORBA/CDR/Vio.java
ViewVC logotype

Diff of /classpath/gnu/CORBA/CDR/Vio.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.7 by audriusa, Tue Oct 4 17:58:14 2005 UTC revision 1.8 by audriusa, Fri Oct 28 13:01:50 2005 UTC
# Line 474  public abstract class Vio Line 474  public abstract class Vio
474        {        {
475          if ((value_tag & vf_CHUNKING) != 0)          if ((value_tag & vf_CHUNKING) != 0)
476            {            {
477              cdrBufOutput output = createBuffer(input, 1024);              BufferedCdrOutput output = createBuffer(input, 1024);
478              // Read the current (not a nested one) value in this spec case.              // Read the current (not a nested one) value in this spec case.
479              readNestedValue(value_tag, input, output, -1);              readNestedValue(value_tag, input, output, -1);
480              cdrBufInput ci = new cdrBufInput(output.buffer.getBuffer());              BufferredCdrInput ci = new BufferredCdrInput(output.buffer.getBuffer());
481              ci.setRunTime(output.getRunTime());              ci.setRunTime(output.getRunTime());
482    
483              input = new noHeaderInput(ci, input);              input = new HeadlessInput(ci, input);
484            }            }
485          else          else
486            {            {
487              if (input instanceof cdrBufInput)              if (input instanceof BufferredCdrInput)
488                {                {
489                  // Highly probable case.                  // Highly probable case.
490                  input = new noHeaderInput((cdrBufInput) input, null);                  input = new HeadlessInput((BufferredCdrInput) input, null);
491                }                }
492              else if (input instanceof noHeaderInput)              else if (input instanceof HeadlessInput)
493                {                {
494                  // There is no need to instantiate one more noHeaderInput                  // There is no need to instantiate one more HeadlessInput
495                  // as we can just reset.                  // as we can just reset.
496                  ((noHeaderInput) input).subsequentCalls = false;                  ((HeadlessInput) input).subsequentCalls = false;
497                }                }
498              else              else
499                {                {
500                  cdrBufOutput bout = new cdrBufOutput();                  BufferedCdrOutput bout = new BufferedCdrOutput();
501                  int c;                  int c;
502                  while ((c = input.read()) >= 0)                  while ((c = input.read()) >= 0)
503                    bout.write((byte) c);                    bout.write((byte) c);
504                  input = new noHeaderInput(                  input = new HeadlessInput(
505                    (cdrBufInput) bout.create_input_stream(), input);                    (BufferredCdrInput) bout.create_input_stream(), input);
506                }                }
507            }            }
508        }        }
# Line 520  public abstract class Vio Line 520  public abstract class Vio
520    /**    /**
521     * Create a buffer, inheriting critical settings from the passed input stream.     * Create a buffer, inheriting critical settings from the passed input stream.
522     */     */
523    private static cdrBufOutput createBuffer(InputStream input, int proposed_size)    private static BufferedCdrOutput createBuffer(InputStream input, int proposed_size)
524    {    {
525      cdrBufOutput bout;      BufferedCdrOutput bout;
526      bout = new cdrBufOutput(2 * proposed_size + 256);      bout = new BufferedCdrOutput(2 * proposed_size + 256);
527    
528      if (input instanceof cdrBufInput)      if (input instanceof BufferredCdrInput)
529        {        {
530          cdrBufInput in = (cdrBufInput) input;          BufferredCdrInput in = (BufferredCdrInput) input;
531          bout.setBigEndian(in.isBigEndian());          bout.setBigEndian(in.isBigEndian());
532        }        }
533    
# Line 551  public abstract class Vio Line 551  public abstract class Vio
551     * @return the tag that ended the nested value.     * @return the tag that ended the nested value.
552     */     */
553    public static int readNestedValue(int value_tag, InputStream input,    public static int readNestedValue(int value_tag, InputStream input,
554      cdrBufOutput output, int level)      BufferedCdrOutput output, int level)
555      throws IOException      throws IOException
556    {    {
557      String id = null;      String id = null;
# Line 668  public abstract class Vio Line 668  public abstract class Vio
668      if (value != null)      if (value != null)
669        g.objectWritten(value, position);        g.objectWritten(value, position);
670    
671      if (input instanceof noHeaderInput)      if (input instanceof HeadlessInput)
672        ((noHeaderInput) input).subsequentCalls = false;        ((HeadlessInput) input).subsequentCalls = false;
673    
674      boolean ok = true;      boolean ok = true;
675    
# Line 1034  public abstract class Vio Line 1034  public abstract class Vio
1034    
1035          if (!ok)          if (!ok)
1036            {            {
1037              if (output instanceof cdrBufOutput)              if (output instanceof BufferedCdrOutput)
1038                {                {
1039                  cdrBufOutput b = (cdrBufOutput) output;                  BufferedCdrOutput b = (BufferedCdrOutput) output;
1040                  if (b.runtime == null)                  if (b.runtime == null)
1041                    b.runtime = new gnuRuntime(null, value);                    b.runtime = new gnuRuntime(null, value);
1042                }                }
# Line 1070  public abstract class Vio Line 1070  public abstract class Vio
1070     * Read the indirection data and return the object that was already written to     * Read the indirection data and return the object that was already written to
1071     * this stream.     * this stream.
1072     *     *
1073     * @param an_input the input stream, must be cdrBufInput.     * @param an_input the input stream, must be BufferredCdrInput.
1074     */     */
1075    static Serializable readIndirection(InputStream an_input)    static Serializable readIndirection(InputStream an_input)
1076    {    {

Legend:
Removed from v.1.7  
changed lines
  Added in v.1.8

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26