Class CodeSetConversion.UTF16BTCConverter

Enclosing class:
CodeSetConversion

private class CodeSetConversion.UTF16BTCConverter extends CodeSetConversion.JavaBTCConverter
Special converter for UTF16 since it's required to optionally support a byte order marker while the internal Java converters either require it or require that it isn't there. The solution is to check for the byte order marker, and if we need to do something differently, switch internal converters.
  • Field Details

    • defaultByteOrder

      private ByteOrder defaultByteOrder
    • converterUsesBOM

      private boolean converterUsesBOM
    • UTF16_BE_MARKER

      private static final char UTF16_BE_MARKER
      See Also:
    • UTF16_LE_MARKER

      private static final char UTF16_LE_MARKER
      See Also:
  • Constructor Details

    • UTF16BTCConverter

      UTF16BTCConverter(ByteOrder defaultByteOrder)
  • Method Details

    • getChars

      public char[] getChars(ByteBuffer byteBuffer, int offset, int numBytes)
      Overrides:
      getChars in class CodeSetConversion.JavaBTCConverter
    • getChars

      public char[] getChars(byte[] bytes, int offset, int numBytes)
      Overrides:
      getChars in class CodeSetConversion.JavaBTCConverter
    • hasUTF16ByteOrderMarker

      private boolean hasUTF16ByteOrderMarker(byte[] array, int offset, int length)
      Utility method for determining if a UTF-16 byte order marker is present.
    • switchToConverter

      private void switchToConverter(OSFCodeSetRegistry.Entry newCodeSet)
      The current solution for dealing with UTF-16 in CORBA is that if our sun.io converter requires byte order markers, and then we see a CORBA wstring/wchar without them, we switch to the sun.io converter that doesn't require them.