Examples of CountingInputStream


Examples of org.apache.tika.io.CountingInputStream

        // Automatically detect the MIME type of the document
        MediaType type = detector.detect(stream, metadata);
        metadata.set(Metadata.CONTENT_TYPE, type.toString());

        // TIKA-216: Zip bomb prevention
        CountingInputStream count = new CountingInputStream(stream);
        SecureContentHandler secure = new SecureContentHandler(handler, count);

        // Parse the document
        try {
            super.parse(count, secure, metadata, context);
View Full Code Here

Examples of org.apache.tika.io.CountingInputStream

    private CountingInputStream stream;

    private SecureContentHandler handler;

    protected void setUp() {
        stream = new CountingInputStream(new NullInputStream(MANY_BYTES));
        handler = new SecureContentHandler(new DefaultHandler(), stream);
    }
View Full Code Here

Examples of org.apache.tika.io.CountingInputStream

        // Automatically detect the MIME type of the document
        MediaType type = detector.detect(stream, metadata);
        metadata.set(Metadata.CONTENT_TYPE, type.toString());

        // TIKA-216: Zip bomb prevention
        CountingInputStream count = new CountingInputStream(stream);
        SecureContentHandler secure = new SecureContentHandler(handler, count);

        // Parse the document
        try {
            super.parse(count, secure, metadata, context);
View Full Code Here

Examples of org.terrier.utility.io.CountingInputStream

    start = offset;
   
    if (codec !=null)
    {
      start = 0;
      inputStream = new CountingInputStream(_input);
      internalInputStream = codec.createInputStream(inputStream);
    }
    else
    {
      if (start != 0) //TODO: start is always zero?
      {
            --start;
            _input.seek(start);
      }
      internalInputStream = inputStream = new CountingInputStream(_input, start);
    }
    Collection rtr = CollectionFactory.loadCollection(
      ApplicationSetup.getProperty("trec.collection.class", "TRECCollection"),
      new Class[]{InputStream.class},
      new Object[]{internalInputStream});
View Full Code Here

Examples of org.terrier.utility.io.CountingInputStream

    readDocumentBlacklist(ApplicationSetup.makeAbsolute(
      ApplicationSetup.getProperty("trec.blacklist.docids", ""),
    ApplicationSetup.TERRIER_ETC));
   
     
    br = input instanceof CountingInputStream ? (CountingInputStream)input : new CountingInputStream(input);
    documentsInThisFile = 0;
  }
View Full Code Here

Examples of org.terrier.utility.io.CountingInputStream

        {
          //logger.warn("Could not open "+filename+" : Cannot read");
        }
        else
        //filename seems ok, open it
          br = new CountingInputStream(Files.openFileStream(filename)); //throws an IOException, throw upwards
          //logger.info("Processing "+filename);
          currentFilename = filename;
          //no need to loop again
          tryFile = false;
          //return success
View Full Code Here

Examples of org.tmatesoft.svn.core.internal.util.CountingInputStream

            }
            return -1;
        }

        if (mySAXParser == null) {
            CountingInputStream stream = null;
            try {
                mySAXParser = getSAXParserFactory().newSAXParser();
                if (myRequest.getContentLength() > 0) {
                    org.xml.sax.XMLReader reader = mySAXParser.getXMLReader();
                    reader.setContentHandler(this);
                    reader.setDTDHandler(this);
                    reader.setErrorHandler(this);
                    reader.setEntityResolver(this);
                    stream = new CountingInputStream(getRequestInputStream());
                    XMLReader xmlReader = new XMLReader(stream);
                    reader.parse(new InputSource(xmlReader));
                }
            } catch (ParserConfigurationException e) {
                if (stream == null || stream.getBytesRead() > 0) {
                    SVNErrorManager.error(SVNErrorMessage.create(SVNErrorCode.RA_DAV_REQUEST_FAILED, e), e, SVNLogType.NETWORK);
                }
            } catch (SAXException e) {
                if (stream == null || stream.getBytesRead() > 0) {
                    SVNErrorManager.error(SVNErrorMessage.create(SVNErrorCode.RA_DAV_REQUEST_FAILED, e), e, SVNLogType.NETWORK);
                }
            } catch (IOException e) {
                if (stream == null || stream.getBytesRead() > 0) {
                    SVNErrorManager.error(SVNErrorMessage.create(SVNErrorCode.RA_DAV_REQUEST_FAILED, e), e, SVNLogType.NETWORK);
                }
            }

            if (stream != null) {
                if (stream.getBytesRead() > 0) {
                    getDAVRequest().init();
                }
                return stream.getBytesRead();
            }
        }
       
        return 0;
    }
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.