示例#1
0
 public void testEofReadUpTo() throws Exception {
   writeToPipe("mark one, mark two, the end");
   output.close();
   assertFalse(reader.isEof());
   reader.readUpTo("one");
   assertFalse(reader.isEof());
   reader.readUpTo("two");
   assertFalse(reader.isEof());
   reader.readUpTo("three");
   assertTrue(reader.isEof());
 }
示例#2
0
  public void testBytesConsumed() throws Exception {
    writeToPipe("One line\r\n12345abc-boundary");
    assertEquals(0, reader.numberOfBytesConsumed());

    reader.readLine();
    assertEquals(10, reader.numberOfBytesConsumed());

    reader.read(5);
    assertEquals(15, reader.numberOfBytesConsumed());

    reader.readUpTo("-boundary");
    assertEquals(27, reader.numberOfBytesConsumed());
  }