Examples of ReaderInputStream


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

Examples of com.github.dandelion.core.utils.ReaderInputStream

  /**
   * {@inheritDoc}
   */
  @Override
  public void doProcess(Reader reader, Writer writer, ProcessingContext processingContext) throws Exception {
    InputStream is = new ReaderInputStream(reader, processingContext.getContext().getConfiguration()
        .getAssetProcessorEncoding());
    OutputStream os = new WriterOutputStream(writer, processingContext.getContext().getConfiguration()
        .getAssetProcessorEncoding());
    try {
      new JSMin(is, os).jsmin();
    }
    catch (Exception e) {
      throw e;
    }
    finally {
      is.close();
      os.close();
    }
  }
View Full Code Here

Examples of com.ibatis.common.io.ReaderInputStream

      DocumentBuilder db = dbf.newDocumentBuilder();
      db.setErrorHandler(new SimpleErrorHandler(new PrintWriter(errorWriter, true)));
      db.setEntityResolver(new DaoClasspathEntityResolver());

      // Parse input file
      Document doc = db.parse(new ReaderInputStream(reader));
      return doc;
    } catch (Exception e) {
      throw new NestedRuntimeException("XML Parser Error.  Cause: " + e);
    }
  }
View Full Code Here

Examples of com.ibatis.common.io.ReaderInputStream

  private Document stringToDocument (String s) {
    try {
      DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
      DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder();
      return documentBuilder.parse(new ReaderInputStream(new StringReader(s)));
    } catch (Exception e) {
      throw new NestedRuntimeException("Error occurred.  Cause: " + e, e);
    }
  }
View Full Code Here

Examples of com.ibatis.common.io.ReaderInputStream

      DocumentBuilder db = dbf.newDocumentBuilder();
      db.setErrorHandler(new SimpleErrorHandler(new PrintWriter(errorWriter, true)));
      db.setEntityResolver(new DaoClasspathEntityResolver());

      // Parse input file
      Document doc = db.parse(new ReaderInputStream(reader));
      return doc;
    } catch (Exception e) {
      throw new NestedRuntimeException("XML Parser Error.  Cause: " + e);
    }
  }
View Full Code Here

Examples of com.ibm.commons.util.io.ReaderInputStream

   * Decide whether a node should be included in the tree.
   * @param properties
   * @return True if this node is to be included, false if it should not be included in the tree.
   */
  protected boolean includeNode(String properties) {
        ReaderInputStream is = new ReaderInputStream(new StringReader(properties));
        Properties p = new Properties();
        try {
            p.load(is);
        } catch (IOException e) {
            e.printStackTrace();
View Full Code Here

Examples of com.ibm.commons.util.io.ReaderInputStream

      addProperties(p, props);
    }
  }
  protected void addProperties(Properties p, String value) throws IOException {
    if(StringUtil.isNotEmpty(value)) {
      ReaderInputStream is = new ReaderInputStream(new StringReader(value));
      try {
        p.load(is);
      } finally {
        StreamUtil.close(is);
      }
View Full Code Here

Examples of com.ibm.commons.util.io.ReaderInputStream

   */
  public static Property[] parseProperties(String sProperty) throws IOException {
    if(StringUtil.isNotEmpty(sProperty)) {
      Properties props = new Properties();
      StringReader r = new StringReader(sProperty);
      props.load(new ReaderInputStream(r));
      List<Property> properties = new ArrayList<Property>();
      for(Entry<Object, Object> e: props.entrySet()) {
        Property p = new Property((String)e.getKey(),(String)e.getValue());
        properties.add(p);
      }
View Full Code Here

Examples of com.ibm.commons.util.io.ReaderInputStream

      return null;
    }
  }
  private static byte[] decodeBase64(String s) {
    try {
      Base64.InputStream b64 = new Base64.InputStream(new ReaderInputStream(new StringReader(s)));
      ByteBuffer bb = ByteBuffer.allocate(1024*4); // max cookie size
      int byt;
      while( (byt = b64.read()) >= 0)  {
        bb.put((byte) (byt&0xFF));
      }
View Full Code Here

Examples of com.ibm.commons.util.io.ReaderInputStream

                    url = new URL(resourcesXmlVal);
                    // log the fact that we picked up an URL?
                    logMsgs.add("Found a valid URL to global resources descriptor. Accessing URL now..."); // $NLI-WebAppServerPlatform.FoundavalidURLtoglobalresourcesde-1$
                    return url.openStream();
                } catch( MalformedURLException ex) {
                    return new ReaderInputStream(new StringReader(resourcesXmlVal));
                } catch (IOException e) {
                    // log that URL access failed
                    logMsgs.add("IOException while accessing the URL to global resources descriptor."); // $NLE-WebAppServerPlatform.IOExceptionwhileaccessingtheURLto-1$
                }
               
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.