Package org.idpf.epubcheck.util.css
Class CssInputStream
- java.lang.Object
-
- java.io.InputStream
-
- java.io.FilterInputStream
-
- java.io.PushbackInputStream
-
- org.idpf.epubcheck.util.css.CssInputStream
-
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable
public class CssInputStream extends java.io.PushbackInputStreamAn InputStream for CSS files that detects and skips past BOMs, and peeks for @charset rules.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classCssInputStream.Endian
-
Field Summary
Fields Modifier and Type Field Description (package private) com.google.common.base.Optional<java.lang.String>bomprivate static java.util.Map<java.lang.String,byte[]>boms(package private) com.google.common.base.Optional<java.lang.String>charsetprivate booleandebugprivate static intMAX_PUSHBACK
-
Constructor Summary
Constructors Constructor Description CssInputStream(java.io.InputStream in)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private java.lang.StringgetBOM()com.google.common.base.Optional<java.lang.String>getBomCharset()Get the character set as detected from a BOM.com.google.common.base.Optional<java.lang.String>getCssCharset()Get the value of the CSS @charset rule, if present.private java.lang.StringgetCssCharset(java.lang.String bom)private static java.lang.Stringmap(byte[] data)-
Methods inherited from class java.io.PushbackInputStream
available, close, mark, markSupported, read, read, reset, skip, unread, unread, unread
-
-
-
-
Field Detail
-
bom
com.google.common.base.Optional<java.lang.String> bom
-
charset
com.google.common.base.Optional<java.lang.String> charset
-
MAX_PUSHBACK
private static final int MAX_PUSHBACK
- See Also:
- Constant Field Values
-
boms
private static final java.util.Map<java.lang.String,byte[]> boms
-
debug
private boolean debug
-
-
Method Detail
-
getBOM
private java.lang.String getBOM() throws java.io.IOException- Throws:
java.io.IOException
-
getCssCharset
private java.lang.String getCssCharset(java.lang.String bom) throws java.io.IOException- Throws:
java.io.IOException
-
map
private static java.lang.String map(byte[] data)
-
getBomCharset
public final com.google.common.base.Optional<java.lang.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<java.lang.String> getCssCharset()
Get the value of the CSS @charset rule, if present.
-
-