Package org.encog.parse

Examples of org.encog.parse.PeekableInputStream


   *
   * @param is
   *            An InputStream to parse from.
   */
  public ReadTags(final InputStream is) {
    this.source = new PeekableInputStream(is);

    if (ReadTags.charMap == null) {
      ReadTags.charMap = new HashMap<String, Character>();
      ReadTags.charMap.put("nbsp", ' ');
      ReadTags.charMap.put("lt", '<');
View Full Code Here


public class TestPeekableInputStream extends TestCase {
  public void testSimple() throws Throwable
  {
    ByteArrayInputStream bis = new ByteArrayInputStream("test".getBytes());
    PeekableInputStream peek = new PeekableInputStream(bis);
   
    TestCase.assertTrue(peek.read()=='t');
    TestCase.assertTrue(peek.read()=='e');
    TestCase.assertTrue(peek.read()=='s');
    TestCase.assertTrue(peek.read()=='t');
  }
View Full Code Here

  }
 
  public void testPeek() throws Throwable
  {
    ByteArrayInputStream bis = new ByteArrayInputStream("test".getBytes());
    PeekableInputStream peek = new PeekableInputStream(bis);
   
    TestCase.assertTrue(peek.peek(0)=='t');
    TestCase.assertTrue(peek.peek(1)=='e');
    TestCase.assertTrue(peek.peek(2)=='s');
    TestCase.assertTrue(peek.peek(3)=='t');
    TestCase.assertTrue(peek.read()=='t');
    TestCase.assertTrue(peek.read()=='e');
    TestCase.assertTrue(peek.read()=='s');
    TestCase.assertTrue(peek.read()=='t');
  }
View Full Code Here

  }
 
  public void testPeekExtend() throws Throwable
  {
    ByteArrayInputStream bis = new ByteArrayInputStream("012345678901234567890".getBytes());
    PeekableInputStream peek = new PeekableInputStream(bis);
   
    TestCase.assertTrue(peek.peek(0)=='0');
    TestCase.assertTrue(peek.peek(11)=='1');
    // now read past the end of file
    byte junk[] = new byte[100];
    peek.read(junk);
    TestCase.assertTrue(peek.peek()==-1);
   
  }
View Full Code Here

   *
   * @param is
   *            An InputStream to parse from.
   */
  public ReadTags(final InputStream is) {
    this.source = new PeekableInputStream(is);
   
    synchronized(ReadTags.class) {
      if (ReadTags.charMap == null) {
        ReadTags.charMap = new HashMap<String, Character>();
        ReadTags.charMap.put("nbsp", ' ');
View Full Code Here

public class TestPeekableInputStream extends TestCase {
  public void testSimple() throws Throwable
  {
    ByteArrayInputStream bis = new ByteArrayInputStream("test".getBytes());
    PeekableInputStream peek = new PeekableInputStream(bis);
   
    TestCase.assertTrue(peek.read()=='t');
    TestCase.assertTrue(peek.read()=='e');
    TestCase.assertTrue(peek.read()=='s');
    TestCase.assertTrue(peek.read()=='t');
  }
View Full Code Here

  }
 
  public void testPeek() throws Throwable
  {
    ByteArrayInputStream bis = new ByteArrayInputStream("test".getBytes());
    PeekableInputStream peek = new PeekableInputStream(bis);
   
    TestCase.assertTrue(peek.peek(0)=='t');
    TestCase.assertTrue(peek.peek(1)=='e');
    TestCase.assertTrue(peek.peek(2)=='s');
    TestCase.assertTrue(peek.peek(3)=='t');
    TestCase.assertTrue(peek.read()=='t');
    TestCase.assertTrue(peek.read()=='e');
    TestCase.assertTrue(peek.read()=='s');
    TestCase.assertTrue(peek.read()=='t');
  }
View Full Code Here

  }
 
  public void testPeekExtend() throws Throwable
  {
    ByteArrayInputStream bis = new ByteArrayInputStream("012345678901234567890".getBytes());
    PeekableInputStream peek = new PeekableInputStream(bis);
   
    TestCase.assertTrue(peek.peek(0)=='0');
    TestCase.assertTrue(peek.peek(11)=='1');
    // now read past the end of file
    byte junk[] = new byte[100];
    peek.read(junk);
    TestCase.assertTrue(peek.peek()==-1);
   
  }
View Full Code Here

TOP

Related Classes of org.encog.parse.PeekableInputStream

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.