java.lang.Object
java.io.Reader
edu.internet2.middleware.grouperClientExt.com.fasterxml.jackson.core.io.UTF32Reader
All Implemented Interfaces:
Closeable, AutoCloseable, Readable

public class UTF32Reader extends Reader
Since JDK does not come with UTF-32/UCS-4, let's implement a simple decoder to use.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected final boolean
     
    protected byte[]
     
    protected int
    Total read byte count; used for error reporting purposes
    protected int
    Total read character count; used for error reporting purposes
    protected final IOContext
     
    protected InputStream
     
    protected int
     
    protected final boolean
     
    protected int
     
    protected char
    Although input is fine with full Unicode set, Java still uses 16-bit chars, so we may have to split high-order chars into surrogate pairs.
    protected char[]
     
    protected static final int
    JSON actually limits available Unicode range in the high end to the same as xml (to basically limit UTF-8 max byte sequence length to 4)
    protected static final char
     

    Fields inherited from class java.io.Reader

    lock
  • Constructor Summary

    Constructors
    Constructor
    Description
    UTF32Reader(IOContext ctxt, InputStream in, byte[] buf, int ptr, int len, boolean isBigEndian)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
     
    int
    Although this method is implemented by the base class, AND it should never be called by main code, let's still implement it bit more efficiently just in case
    int
    read(char[] cbuf, int start, int len)
     

    Methods inherited from class java.io.Reader

    mark, markSupported, nullReader, read, read, ready, reset, skip, transferTo

    Methods inherited from class java.lang.Object

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

    • LAST_VALID_UNICODE_CHAR

      protected static final int LAST_VALID_UNICODE_CHAR
      JSON actually limits available Unicode range in the high end to the same as xml (to basically limit UTF-8 max byte sequence length to 4)
      See Also:
    • NC

      protected static final char NC
      See Also:
    • _context

      protected final IOContext _context
    • _in

      protected InputStream _in
    • _buffer

      protected byte[] _buffer
    • _ptr

      protected int _ptr
    • _length

      protected int _length
    • _bigEndian

      protected final boolean _bigEndian
    • _surrogate

      protected char _surrogate
      Although input is fine with full Unicode set, Java still uses 16-bit chars, so we may have to split high-order chars into surrogate pairs.
    • _charCount

      protected int _charCount
      Total read character count; used for error reporting purposes
    • _byteCount

      protected int _byteCount
      Total read byte count; used for error reporting purposes
    • _managedBuffers

      protected final boolean _managedBuffers
    • _tmpBuf

      protected char[] _tmpBuf
  • Constructor Details

    • UTF32Reader

      public UTF32Reader(IOContext ctxt, InputStream in, byte[] buf, int ptr, int len, boolean isBigEndian)
  • Method Details