Class CssInputStream

All Implemented Interfaces:
Closeable, AutoCloseable

public class CssInputStream extends PushbackInputStream
An InputStream for CSS files that detects and skips past BOMs, and peeks for @charset rules.
  • Field Details

    • bom

      com.google.common.base.Optional<String> bom
    • charset

      com.google.common.base.Optional<String> charset
    • MAX_PUSHBACK

      private static final int MAX_PUSHBACK
      See Also:
    • boms

      private static final Map<String,byte[]> boms
    • debug

      private boolean debug
  • Constructor Details

  • Method Details

    • getBOM

      private String getBOM() throws IOException
      Throws:
      IOException
    • getCssCharset

      private String getCssCharset(String bom) throws IOException
      Throws:
      IOException
    • map

      private static String map(byte[] data)
    • getBomCharset

      public final com.google.common.base.Optional<String> getBomCharset()
      Get the character set as detected from a BOM. If present, the returned string is one of 'UTF-32BE', 'UTF-32LE", 'UTF-8", 'UTF-16BE' or 'UTF-16LE".
    • getCssCharset

      public final com.google.common.base.Optional<String> getCssCharset()
      Get the value of the CSS @charset rule, if present.