/[classpath]/classpath/gnu/CORBA/CdrEncapsCodecImpl.java
ViewVC logotype

Diff of /classpath/gnu/CORBA/CdrEncapsCodecImpl.java

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

revision 1.1 by audriusa, Fri Oct 28 10:33:41 2005 UTC revision 1.2 by audriusa, Fri Oct 28 13:01:50 2005 UTC
# Line 38  exception statement from your version. * Line 38  exception statement from your version. *
38    
39  package gnu.CORBA;  package gnu.CORBA;
40    
41  import gnu.CORBA.CDR.cdrBufInput;  import gnu.CORBA.CDR.BufferredCdrInput;
42  import gnu.CORBA.CDR.cdrBufOutput;  import gnu.CORBA.CDR.BufferedCdrOutput;
43  import gnu.CORBA.CDR.cdrOutput;  import gnu.CORBA.CDR.AbstractCdrOutput;
44    
45  import org.omg.CORBA.Any;  import org.omg.CORBA.Any;
46  import org.omg.CORBA.LocalObject;  import org.omg.CORBA.LocalObject;
# Line 125  public class CdrEncapsCodecImpl Line 125  public class CdrEncapsCodecImpl
125    public Any decode(byte[] them)    public Any decode(byte[] them)
126               throws FormatMismatch               throws FormatMismatch
127    {    {
128      cdrBufInput input = createInput(them);      BufferredCdrInput input = createInput(them);
129      cdrBufInput encapsulation = createEncapsulation(them, input);      BufferredCdrInput encapsulation = createEncapsulation(them, input);
130    
131      TypeCode type = encapsulation.read_TypeCode();      TypeCode type = encapsulation.read_TypeCode();
132    
# Line 142  public class CdrEncapsCodecImpl Line 142  public class CdrEncapsCodecImpl
142      return readAny(type, encapsulation);      return readAny(type, encapsulation);
143    }    }
144    
145    private cdrBufInput createEncapsulation(byte[] them, cdrBufInput input)    private BufferredCdrInput createEncapsulation(byte[] them, BufferredCdrInput input)
146    {    {
147      cdrBufInput encapsulation;      BufferredCdrInput encapsulation;
148    
149      if ((them [ 0 ] | them [ 1 ] | them [ 2 ] | them [ 3 ]) == 0)      if ((them [ 0 ] | them [ 1 ] | them [ 2 ] | them [ 3 ]) == 0)
150        {        {
# Line 163  public class CdrEncapsCodecImpl Line 163  public class CdrEncapsCodecImpl
163    {    {
164      checkTypePossibility("", that.type());      checkTypePossibility("", that.type());
165    
166      cdrBufOutput output = createOutput(that);      BufferedCdrOutput output = createOutput(that);
167    
168      // cdrBufOutput has internal support for this encoding.      // BufferedCdrOutput has internal support for this encoding.
169      cdrOutput encapsulation = output.createEncapsulation();      AbstractCdrOutput encapsulation = output.createEncapsulation();
170    
171      try      try
172        {        {
# Line 207  public class CdrEncapsCodecImpl Line 207  public class CdrEncapsCodecImpl
207          throw new TypeMismatch(ex.getMessage());          throw new TypeMismatch(ex.getMessage());
208        }        }
209    
210      cdrBufInput input = createInput(them);      BufferredCdrInput input = createInput(them);
211      cdrBufInput encapsulation = createEncapsulation(them, input);      BufferredCdrInput encapsulation = createEncapsulation(them, input);
212      return readAny(type, encapsulation);      return readAny(type, encapsulation);
213    }    }
214    
# Line 218  public class CdrEncapsCodecImpl Line 218  public class CdrEncapsCodecImpl
218     * @param type a type of the Any to read.     * @param type a type of the Any to read.
219     * @param input the encapsulation stream.     * @param input the encapsulation stream.
220     */     */
221    private Any readAny(TypeCode type, cdrBufInput encapsulation)    private Any readAny(TypeCode type, BufferredCdrInput encapsulation)
222                 throws MARSHAL                 throws MARSHAL
223    {    {
224      gnuAny a = new gnuAny();      gnuAny a = new gnuAny();
225      a.setOrb(orb);      a.setOrb(orb);
226    
227      // cdrBufInput has internal support for this encoding.      // BufferredCdrInput has internal support for this encoding.
228      a.read_value(encapsulation, type);      a.read_value(encapsulation, type);
229      return a;      return a;
230    }    }
# Line 235  public class CdrEncapsCodecImpl Line 235  public class CdrEncapsCodecImpl
235    {    {
236      checkTypePossibility("", that.type());      checkTypePossibility("", that.type());
237    
238      cdrBufOutput output = createOutput(that);      BufferedCdrOutput output = createOutput(that);
239    
240      cdrOutput encapsulation = output.createEncapsulation();      AbstractCdrOutput encapsulation = output.createEncapsulation();
241    
242      try      try
243        {        {
# Line 258  public class CdrEncapsCodecImpl Line 258  public class CdrEncapsCodecImpl
258    
259    /**    /**
260     * Create the CDR output stream for writing the given Any.     * Create the CDR output stream for writing the given Any.
261     * The cdrBufOutput has internal support for encapsulation encodings.     * The BufferedCdrOutput has internal support for encapsulation encodings.
262     *     *
263     * @param that the Any that will be written.     * @param that the Any that will be written.
264     *     *
# Line 267  public class CdrEncapsCodecImpl Line 267  public class CdrEncapsCodecImpl
267     * @throws InvalidTypeForEncoding if that Any cannot be written under the     * @throws InvalidTypeForEncoding if that Any cannot be written under the
268     * given version.     * given version.
269     */     */
270    private cdrBufOutput createOutput(Any that)    private BufferedCdrOutput createOutput(Any that)
271                               throws InvalidTypeForEncoding                               throws InvalidTypeForEncoding
272    {    {
273      cdrBufOutput output = new cdrBufOutput();      BufferedCdrOutput output = new BufferedCdrOutput();
274      output.setOrb(orb);      output.setOrb(orb);
275      output.setVersion(version);      output.setVersion(version);
276      return output;      return output;
# Line 327  public class CdrEncapsCodecImpl Line 327  public class CdrEncapsCodecImpl
327     *     *
328     * @return the stream.     * @return the stream.
329     */     */
330    private cdrBufInput createInput(byte[] them)    private BufferredCdrInput createInput(byte[] them)
331    {    {
332      cdrBufInput input = new cdrBufInput(them);      BufferredCdrInput input = new BufferredCdrInput(them);
333      input.setOrb(orb);      input.setOrb(orb);
334      input.setVersion(version);      input.setVersion(version);
335      return input;      return input;

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

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