Package java.io

Examples of java.io.Reader.reset()


     
      // 7. Set up a Reader over the read content
      r = getTrecDocReader(docBuf);
      // Resetting the thread's reader means it will reuse the instance
      // allocated as well as re-read from docBuf.
      r.reset();
     
      // count char length of parsed html text (larger than the plain doc body text).
      addBytes(docBuf.length());
    }
View Full Code Here


    Reader reader = new LimitReader(data, 10);
    char[] buf = new char[5];
    reader.mark(100);
    reader.read(buf);
    assertArrayEquals("Hello".toCharArray(), buf);
    reader.reset();
    reader.read(buf);
    assertArrayEquals("Hello".toCharArray(), buf);
  }

  @Test
View Full Code Here

            // TIKA-240: Drop the BOM when extracting plain text
            reader.mark(1);
            int bom = reader.read();
            if (bom != '\ufeff') { // zero-width no-break space
                reader.reset();
            }

            XHTMLContentHandler xhtml =
                new XHTMLContentHandler(handler, metadata);
            xhtml.startDocument();
View Full Code Here

                        caw.append((char)c);
                    }
                } catch (IOException ignored) {
                }
                caw.close();
                try{ rdr.reset();} catch(IOException ignored) {}
                ret = new SAXSource(new InputSource(new CharArrayReader(caw.toCharArray())));
            } else {
                ret = new SAXSource();
            }
        } else if(src instanceof StreamSource) {
View Full Code Here

                        caw.append((char)c);
                    }
                } catch (IOException ignored) {
                }
                caw.close();
                try{ rdr.reset();} catch(IOException ignored) {}
                ret = new StreamSource(new CharArrayReader(caw.toCharArray()));
            } else {
                ret = new StreamSource();
            }
        }
View Full Code Here

                        caw.append((char)c);
                    }
                } catch (IOException ignored) {
                }
                caw.close();
                try{ rdr.reset();} catch(IOException ignored) {}
                ret = new SAXSource(new InputSource(new CharArrayReader(caw.toCharArray())));
            } else {
                ret = new SAXSource();
            }
        } else if(src instanceof StreamSource) {
View Full Code Here

                        caw.append((char)c);
                    }
                } catch (IOException ignored) {
                }
                caw.close();
                try{ rdr.reset();} catch(IOException ignored) {}
                ret = new StreamSource(new CharArrayReader(caw.toCharArray()));
            } else {
                ret = new StreamSource();
            }
        }
View Full Code Here

        throws SQLException {
    Reader clobInput = new StringReader(clobData);
        PreparedStatement pStmt =
            con.prepareStatement("update BLOBCLOB set CLOBDATA = ? where ID = ?");
        try {
            clobInput.reset();
        } catch (IOException ioe) {
            fail("Failed to reset clob input stream: " + ioe.getMessage());
        }
        pStmt.setClob(1, clobInput, clobData.length());
        pStmt.setInt(2, ID_SAMPLEVALUES);
View Full Code Here

            // TIKA-240: Drop the BOM when extracting plain text
            reader.mark(1);
            int bom = reader.read();
            if (bom != '\ufeff') { // zero-width no-break space
                reader.reset();
            }

            XHTMLContentHandler xhtml =
                new XHTMLContentHandler(handler, metadata);
            xhtml.startDocument();
View Full Code Here

                    if (br.read() == em.charAt(1)) {
                      // Matched end
                      break;
                    } else {
                      // Only one
                      br.reset();
                    }
                  } else break;
                }
                sb.append((char) c);
              }
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.