Package com.dd.plist

Class ByteOrderMarkReader


  • class ByteOrderMarkReader
    extends java.lang.Object
    Reads Byte Order Marks for various Unicode encodings.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private static int[][] BOMs  
      private java.lang.String charset  
      private boolean[] charsetPossible  
      private static java.lang.String[] Charsets  
      private int offset  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String detect​(byte[] bytes)
      Detects the encoding of input data that is available as a complete byte array.
      java.lang.String getDetectedCharset()
      Gets the charset that was detected.
      boolean readByte​(int b)
      Processes a byte that was read from the input.
      • Methods inherited from class java.lang.Object

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

      • BOMs

        private static final int[][] BOMs
      • Charsets

        private static final java.lang.String[] Charsets
      • charsetPossible

        private final boolean[] charsetPossible
      • offset

        private int offset
      • charset

        private java.lang.String charset
    • Constructor Detail

      • ByteOrderMarkReader

        ByteOrderMarkReader()
    • Method Detail

      • getDetectedCharset

        public java.lang.String getDetectedCharset()
        Gets the charset that was detected.
        Returns:
        The name of the detected charset, or null if no charset was detected.
      • readByte

        public boolean readByte​(int b)
        Processes a byte that was read from the input.
        Parameters:
        b - The byte to process.
        Returns:
        true if the input so far could potentially be a BOM; otherwise, false.
      • detect

        public static java.lang.String detect​(byte[] bytes)
        Detects the encoding of input data that is available as a complete byte array.
        Parameters:
        bytes - The input data.
        Returns:
        The name of the detected charset, or null if no BOM was detected.