Class UnicodeToBinaryStream

  • All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable

    final class UnicodeToBinaryStream
    extends java.io.InputStream
    An object that wraps around a Reader and translates the unicode stream into a stream of bytes that the database is able to transfer to the database. This object simply converts each char from the Reader into two bytes. See also BinaryToUnicodeReader for the Reader version of this class.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private int current_c
      The current character if 'lr_byte' is 1.
      private int lr_byte
      If this is 0 we are on the left byte of the character.
      private java.io.Reader reader
      The Reader we are wrapping.
    • Constructor Summary

      Constructors 
      Constructor Description
      UnicodeToBinaryStream​(java.io.Reader reader)
      Constructs the stream.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int available()  
      int read()
      Reads the next character from the stream.
      • Methods inherited from class java.io.InputStream

        close, mark, markSupported, nullInputStream, read, read, readAllBytes, readNBytes, readNBytes, reset, skip, transferTo
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • reader

        private java.io.Reader reader
        The Reader we are wrapping.
      • lr_byte

        private int lr_byte
        If this is 0 we are on the left byte of the character. If this is 1 we are on the right byte of the current character.
      • current_c

        private int current_c
        The current character if 'lr_byte' is 1.
    • Constructor Detail

      • UnicodeToBinaryStream

        public UnicodeToBinaryStream​(java.io.Reader reader)
        Constructs the stream.
    • Method Detail

      • read

        public int read()
                 throws java.io.IOException
        Reads the next character from the stream.
        Specified by:
        read in class java.io.InputStream
        Throws:
        java.io.IOException
      • available

        public int available()
                      throws java.io.IOException
        Overrides:
        available in class java.io.InputStream
        Throws:
        java.io.IOException