Package java.io

Examples of java.io.PushbackReader


  /**
   * @tests java.io.PushbackReader#unread(char[], int, int)
   */
  public void test_unread_$CII_Exception_InsufficientBuffer() throws IOException {
    //a pushback reader with one character buffer
    pbr = new PushbackReader(new StringReader(pbString));
   
    //if count > buffer's size , should throw IOException
    try {
      pbr.unread(new char[pbString.length()], 0, 2);
      fail("should throw IOException");
View Full Code Here


  /**
   * @tests java.io.PushbackReader#unread(char[], int, int)
   */
  public void test_unread_$CII_ArrayIndexOutOfBoundsException() throws IOException {
    //a pushback reader with one character buffer
    pbr = new PushbackReader(new StringReader(pbString));
   
    try {
      pbr.unread(new char[pbString.length()], -1 , -1);
      fail("should throw ArrayIndexOutOfBoundsException");
    } catch (ArrayIndexOutOfBoundsException e) {
View Full Code Here

  /**
   * Sets up the fixture, for example, open a network connection. This method
   * is called before a test is executed.
   */
  protected void setUp() {
    pbr = new PushbackReader(new StringReader(pbString), 10);
  }
View Full Code Here

    }
   
    /** Creates a new instance of CsvInputArchive */
    public CsvInputArchive(InputStream in)
    throws UnsupportedEncodingException {
        stream = new PushbackReader(new InputStreamReader(in, "UTF-8"));
    }
View Full Code Here

   * @param reader the reader
   * @param presentation If not <code>null</code>, formattings will be applied to
   * the presentation.
  */
  public HTML2TextReader(Reader reader, TextPresentation presentation) {
    super(new PushbackReader(reader));
    fTextPresentation= presentation;
  }
View Full Code Here

    private PushbackReader reader;

    public Parser getParser(String queryText) {
        checkNotEmptyString("queryText", queryText);
        StringReader in = new StringReader(queryText);
        reader = new PushbackReader(in, PUSHBACK_BUFFER_SIZE);
        Lexer lexer = new Lexer(reader);
        return new Parser(lexer);
    }
View Full Code Here

    public Template(Reader reader) throws IOException
    {
        try
        {
            // TODO decide if there is a better buffer size
            Lexer lexer = new Lexer(new PushbackReader(reader, 1024));
            Parser parser = new Parser(lexer);
            templateAST = parser.parse();
        }
        catch (ParserException e)
        {
View Full Code Here

    final Reader reader = this.stream2reader(url.openStream(), charsRead);
    if (charsRead.length() == 0) {
      return reader;
    }
    final String charsReadStr = charsRead.toString();
    final PushbackReader pbreader = new PushbackReader(reader, charsReadStr.length());
    for (int i = charsReadStr.length() - 1; i >= 0; i--) {
      pbreader.unread(charsReadStr.charAt(i));
    }
    return pbreader;
  }
View Full Code Here

      currentReader.lineReader = null;
      currentReader.pbReader = reader;
    }
    else {
      currentReader.lineReader = new LineNumberReader(reader);
      currentReader.pbReader = new PushbackReader(currentReader.lineReader, 2);
    }
    currentReader.systemId = oldReader.systemId;
    currentReader.publicId = oldReader.publicId;
  }
View Full Code Here

    private int theA;

    private int theB;

    public JSMin(Reader in, Writer out) {
        this.in = new PushbackReader(in);
        this.out = out;
    }
View Full Code Here

TOP

Related Classes of java.io.PushbackReader

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.