1 package org.jahia.utils.fileparsers; 2 3 import java.io.IOException ; 4 import java.io.InputStream ; 5 import java.io.InputStreamReader ; 6 import org.jahia.utils.FileUtils; 7 8 9 20 21 public class TextExtractor implements FileExtractor { 22 23 public TextExtractor(){ 24 } 25 26 36 public String getContentAsString(String path, long lastModified, 37 InputStream fileStream) 38 throws IOException { 39 return getContentAsString(path, lastModified, fileStream, null); 40 } 41 42 53 public String getContentAsString(String path, long lastModified, 54 InputStream fileStream, String charSet) 55 throws IOException { 56 InputStreamReader reader = null; 57 if ( charSet != null ){ 58 reader = new InputStreamReader (fileStream, charSet); 59 } else { 60 reader = new InputStreamReader (fileStream); 61 } 62 return FileUtils.readerToString(reader); 63 } 64 } 65 | Popular Tags |