1. /*
  2. * @(#)Message_1_2.java 1.7 04/06/21
  3. *
  4. * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
  5. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
  6. */
  7. package com.sun.corba.se.impl.protocol.giopmsgheaders;
  8. import java.nio.ByteBuffer;
  9. import com.sun.corba.se.spi.ior.iiop.GIOPVersion;
  10. public class Message_1_2 extends Message_1_1
  11. {
  12. protected int request_id = (int) 0;
  13. Message_1_2() {}
  14. Message_1_2(int _magic, GIOPVersion _GIOP_version, byte _flags,
  15. byte _message_type, int _message_size) {
  16. super(_magic,
  17. _GIOP_version,
  18. _flags,
  19. _message_type,
  20. _message_size);
  21. }
  22. /**
  23. * The byteBuffer is presumed to have contents of the message already
  24. * read in. It must have 12 bytes of space at the beginning for the GIOP header,
  25. * but the header doesn't have to be copied in.
  26. */
  27. public void unmarshalRequestID(ByteBuffer byteBuffer) {
  28. int b1, b2, b3, b4;
  29. if (!isLittleEndian()) {
  30. b1 = (byteBuffer.get(GIOPMessageHeaderLength+0) << 24) & 0xFF000000;
  31. b2 = (byteBuffer.get(GIOPMessageHeaderLength+1) << 16) & 0x00FF0000;
  32. b3 = (byteBuffer.get(GIOPMessageHeaderLength+2) << 8) & 0x0000FF00;
  33. b4 = (byteBuffer.get(GIOPMessageHeaderLength+3) << 0) & 0x000000FF;
  34. } else {
  35. b1 = (byteBuffer.get(GIOPMessageHeaderLength+3) << 24) & 0xFF000000;
  36. b2 = (byteBuffer.get(GIOPMessageHeaderLength+2) << 16) & 0x00FF0000;
  37. b3 = (byteBuffer.get(GIOPMessageHeaderLength+1) << 8) & 0x0000FF00;
  38. b4 = (byteBuffer.get(GIOPMessageHeaderLength+0) << 0) & 0x000000FF;
  39. }
  40. this.request_id = (b1 | b2 | b3 | b4);
  41. }
  42. public void write(org.omg.CORBA.portable.OutputStream ostream) {
  43. if (this.encodingVersion == Message.CDR_ENC_VERSION) {
  44. super.write(ostream);
  45. return;
  46. }
  47. GIOPVersion gv = this.GIOP_version; // save
  48. this.GIOP_version = GIOPVersion.getInstance((byte)13,
  49. this.encodingVersion);
  50. super.write(ostream);
  51. this.GIOP_version = gv; // restore
  52. }
  53. }