JAV2I 1.2 NO IDEA Avatar
  1. OMG Issue

JAV2I12 — New issue: Behavior of writeByte, writeChar, writeBytes, writeChars

  • Key: JAV2I12-7
  • Legacy Issue Number: 4591
  • Status: closed  
  • Source: Oracle ( Everett Anderson)
  • Summary:

    A Serializable or Externalizable can define methods which take
    java.io.ObjectOutputStreams. There are four methods on that class
    that are well defined in Java, but the mapping to CORBA may need to be
    clarified:

    writeByte(int)
    writeChar(int)
    writeBytes(String)
    writeChars(String)

    Please see the Java docs for these methods:

    http://java.sun.com/j2se/1.3/docs/api/java/io/DataOutput.html#writeByte(int)
    http://java.sun.com/j2se/1.3/docs/api/java/io/DataOutput.html#writeChar(int)
    http://java.sun.com/j2se/1.3/docs/api/java/io/DataOutput.html#writeBytes(java.lang.String)
    http://java.sun.com/j2se/1.3/docs/api/java/io/DataOutput.html#writeChars(java.lang.String)

    Based on those detailed definitions, I'd say the mapping would be:

    writeByte(int)

    • write_octet of the lower 8 bits of the int

    writeChar(int)

    • two write_octet calls in the order as shown in the java docs

    writeBytes(String)

    • For each char in the String, call charAt, take the lower 8 bits, and
      call write_octet

    writeChars(String)

    • For each char in the String, call charAt, split the char into two
      bytes, and make two write_octet calls in the order shown in the java
      docs

    Another interpretation might be to use wstrings or wchar arrays for
    writeChars. The problem I see there is that since there isn't a
    readChars method, the user will be using the DataInput methods
    readFully or multiple readChar calls to reconstruct the String. Since
    the wire format of wstrings/wchars depends on the code set, he might
    start to see code set specific bytes instead of the expected bytes
    detailed in the java docs of writeChars and writeChar.

  • Reported: JAV2I 1.1 — Thu, 4 Oct 2001 04:00 GMT
  • Disposition: Resolved — JAV2I 1.2
  • Disposition Summary:

    see below

  • Updated: Fri, 6 Mar 2015 20:58 GMT