}
else if(compressor.equals("bzip2")) {
out = new BZip2CompressorOutputStream(out);
}
ReaderInputStream ris = null;
try {
int count;
ris = new ReaderInputStream(fulltext, StandardCharsets.UTF_8);
int metadataLimit = Config.getIntProperty("META_DATA_MAX_SIZE", 5) * 1024 * 1024;
int numOfChunks = metadataLimit / 1024;
char[] buf = new char[1024];
byte[] bytes = new byte[1024];
while ((count = fulltext.read(buf)) > 0 && numOfChunks>0) {
String lowered = new String(buf);
lowered = lowered.toLowerCase();
bytes = lowered.getBytes(StandardCharsets.UTF_8);
out.write(bytes, 0, count);
numOfChunks --;
}
}catch(IOException ioExc){
Logger.debug( this.getClass(), "Error Reading TikaParse Stream.", ioExc );
}finally {
if ( out != null ) {
try {
out.close();
} catch ( IOException e ) {
Logger.warn( this.getClass(), "Error Closing Stream.", e );
}
}
if ( ris != null ) {
try {
ris.close();
} catch ( IOException e ) {
Logger.warn( this.getClass(), "Error Closing Stream.", e );
}
}