Package com.helger.base.charset
Class CharsetHelper.InputStreamAndCharset
java.lang.Object
com.helger.base.charset.CharsetHelper.InputStreamAndCharset
- All Implemented Interfaces:
IHasInputStream
- Enclosing class:
CharsetHelper
public static final class CharsetHelper.InputStreamAndCharset
extends Object
implements IHasInputStream
- Author:
- Philip Helger
-
Constructor Summary
ConstructorsConstructorDescriptionInputStreamAndCharset(@NonNull InputStream aIS, @Nullable EUnicodeBOM eBOM, @Nullable Charset aCharset) Constructor. -
Method Summary
Modifier and TypeMethodDescription@Nullable EUnicodeBOMgetBOM()@Nullable Charset@Nullable CharsetgetCharset(@Nullable Charset aFallbackCharset) Get the detected charset or the provided fallback.@NonNull InputStreamGet the input stream to read from the object.booleanhasBOM()booleanbooleanCheck if theInputStreamfromIHasInputStream.getInputStream()andIHasInputStream.getBufferedInputStream()can be acquired more than once.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.helger.base.io.iface.IHasInputStream
getBufferedInputStream, withBufferedInputStreamDo, withInputStreamDo
-
Constructor Details
-
InputStreamAndCharset
public InputStreamAndCharset(@NonNull InputStream aIS, @Nullable EUnicodeBOM eBOM, @Nullable Charset aCharset) Constructor.- Parameters:
aIS- The input stream. May not benull.eBOM- The detected Unicode BOM. May benull.aCharset- The detected charset. May benull.
-
-
Method Details
-
getInputStream
Description copied from interface:IHasInputStreamGet the input stream to read from the object. Each time this method is called, a newInputStreamneeds to be created.- Specified by:
getInputStreamin interfaceIHasInputStream- Returns:
- The input stream. Never
null.
-
isReadMultiple
public boolean isReadMultiple()Description copied from interface:IHasInputStreamCheck if theInputStreamfromIHasInputStream.getInputStream()andIHasInputStream.getBufferedInputStream()can be acquired more than once.- Specified by:
isReadMultiplein interfaceIHasInputStream- Returns:
falsebecause the input stream can only be read once.
-
getBOM
- Returns:
- The detected Unicode BOM. May be
nullif none was found.
-
hasBOM
public boolean hasBOM()- Returns:
trueif a Unicode BOM was detected,falseotherwise.
-
getCharset
- Returns:
- The detected charset from the BOM. May be
null.
-
hasCharset
public boolean hasCharset()- Returns:
trueif a charset was detected from the BOM,falseotherwise.
-
getCharset
Get the detected charset or the provided fallback.- Parameters:
aFallbackCharset- The fallback charset to use. May benull.- Returns:
- The detected charset or the fallback charset.
-