Package com.dotcms.repackage.org.apache.commons.io.input

Examples of com.dotcms.repackage.org.apache.commons.io.input.ReaderInputStream


          }
          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 );
              }
            }

View Full Code Here

TOP

Related Classes of com.dotcms.repackage.org.apache.commons.io.input.ReaderInputStream

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.