Package java.io

Examples of java.io.Reader.mark()


      Reader r = req.getReader();
     
      JSONObject args = null;
      String name = getServletContext().getServletContextName();
   
      r.mark(1024);
      if(r.read() != -1) {
       
        r.reset();
       
        args = new JSONObject(r);
View Full Code Here


      int h2 = docBuf.indexOf(TERMINATING_DOCHDR,h1);
      String dateStr = extract(docBuf, DATE, DATE_END, h2, null);
      if (dateStr != null) {
        date = trecSrc.parseDate(dateStr);
      }
      r.mark(h2+TERMINATING_DOCHDR_LENGTH);
    }

    r.reset();
    HTMLParser htmlParser = trecSrc.getHtmlParser();
    return htmlParser.parse(docData, name, date, null, r, null);
View Full Code Here

                if (LOGGER.isLoggable(Level.FINER))
                  maxChars = 64000;
                if (LOGGER.isLoggable(Level.FINEST))
                  maxChars = 640000// Bill gates says 640k is good enough for anyone
               
                xml.mark(maxChars+1); // +1 so if you read the whole thing you can still reset()
                char buffer[] = new char[maxChars];
                int actualRead = xml.read(buffer);
                xml.reset();
                LOGGER.fine("------------XML POST START-----------\n"+new String(buffer,0,actualRead)+"\n------------XML POST END-----------");
                if (actualRead ==maxChars )
View Full Code Here

   
    try {
      reader = createReader(in, encoding);
     
      if (reader.markSupported()) {
        reader.mark(IN_MEMORY_THRESHOLD);
      }
     
      long length = StreamUtil.getContentLength(reader);
     
      if (reader.markSupported() && length <= IN_MEMORY_THRESHOLD) {
View Full Code Here

        assertEquals(0, reader.skip(-1));
       
        assertTrue(reader.markSupported());
        reader = sb.asReader();
        assertEquals('s', reader.read());
        reader.mark(-1);
        char[] array = new char[3];
        assertEquals(3, reader.read(array, 0, 3));
        assertEquals('o', array[0]);
        assertEquals('m', array[1]);
        assertEquals('e', array[2]);
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.