de.caff.util

## Enum ByteOrderMark

- java.lang.Object
- - java.lang.Enum<ByteOrderMark>
  - - de.caff.util.ByteOrderMark

- All Implemented Interfaces:
    java.io.Serializable, java.lang.Comparable<ByteOrderMark>

      public enum ByteOrderMark
      extends java.lang.Enum<ByteOrderMark>

  Byte order mark support.
  Author:
    Rammi

- - ### Enum Constant Summary

    Enum Constants
    Enum Constant and Description
    `Utf16BE` UTF-16 big endian byte order mark.
    `Utf16LE` UTF-16 little endian byte order mark.
    `Utf32BE` Utf-32 big endian byte order mark.
    `Utf32LE` Utf-32 little endian byte order mark.
    `Utf8` UTF-8 byte order mark.

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static ByteOrderMark` | `check(java.io.InputStream is)` Check whether the given stream starts with a byte order mark.
    `java.nio.charset.Charset` | `getCharset()` Get the charset indicated by this byte order mark.
    `static ByteOrderMark` | `valueOf(java.lang.String name)` Returns the enum constant of this type with the specified name.
    `static ByteOrderMark[]` | `values()` Returns an array containing the constants of this enum type, in the order they are declared.
    `void` | `write(java.io.OutputStream os)` Write the byte order mark to the given stream.

    - ### Methods inherited from class java.lang.Enum

      `clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf`

    - ### Methods inherited from class java.lang.Object

      `getClass, notify, notifyAll, wait, wait, wait`

- - ### Enum Constant Detail

    - #### Utf8

          public static final ByteOrderMark Utf8

      UTF-8 byte order mark.

    - #### Utf16BE

          public static final ByteOrderMark Utf16BE

      UTF-16 big endian byte order mark.

    - #### Utf16LE

          public static final ByteOrderMark Utf16LE

      UTF-16 little endian byte order mark.

    - #### Utf32BE

          public static final ByteOrderMark Utf32BE

      Utf-32 big endian byte order mark.

    - #### Utf32LE

          public static final ByteOrderMark Utf32LE

      Utf-32 little endian byte order mark.

  - ### Method Detail

    - #### values

          public static ByteOrderMark[] values()

      Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:

          for (ByteOrderMark c : ByteOrderMark.values())
              System.out.println(c);

      Returns:
        an array containing the constants of this enum type, in the order they are declared

    - #### valueOf

          public static ByteOrderMark valueOf(java.lang.String name)

      Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
      Parameters:
        `name` - the name of the enum constant to be returned.
      Returns:
        the enum constant with the specified name
      Throws:
        `java.lang.IllegalArgumentException` - if this enum type has no constant with the specified name
        `java.lang.NullPointerException` - if the argument is null

    - #### getCharset

          @NotNull
          public java.nio.charset.Charset getCharset()

      Get the charset indicated by this byte order mark.
      Returns:
        associated charset

    - #### write

          public void write(@NotNull
                            java.io.OutputStream os)
                     throws java.io.IOException

      Write the byte order mark to the given stream.
      Parameters:
        `os` - output stream
      Throws:
        `java.io.IOException` - on write errors

    - #### check

          @Nullable
          public static ByteOrderMark check(@NotNull
                                                      java.io.InputStream is)
                                               throws java.io.IOException

      Check whether the given stream starts with a byte order mark. If a byte order mark is found, it is skipped.
      Parameters:
        `is` - input stream, which has to support marking
      Returns:
        the found BOM or `null` if no BOM was found
      Throws:
        `java.io.IOException` - on read errors