List of usage examples for org.apache.commons.io.input BOMInputStream BOMInputStream
public BOMInputStream(InputStream delegate, boolean include, ByteOrderMark... boms)
From source file:org.terems.webz.internals.FileDownloaderWithBOM.java
public FileDownloaderWithBOM(WebzInputStreamDownloader downloader, String defaultEncoding) throws IOException, WebzException { this.bomIn = (BOMInputStream) new BOMInputStream(downloader.getInputStream(), false, ALL_BOMS); this.downloader = new FileDownloader(downloader.getFileSpecific(), bomIn); ByteOrderMark bom = bomIn.getBOM();/*from w ww. j a va 2s . c o m*/ if (bom == null) { actualEncoding = defaultEncoding; actualNumberOfBytes = downloader.getFileSpecific().getNumberOfBytes(); } else { actualEncoding = bom.getCharsetName(); actualNumberOfBytes = downloader.getFileSpecific().getNumberOfBytes() - bom.length(); } reader = new InputStreamReader(bomIn, actualEncoding); }