Esempio n. 1
0
 public void testEofReadLine() throws Exception {
   writeToPipe("one line\ntwo lines\nthree lines");
   output.close();
   assertFalse(reader.isEof());
   reader.readLine();
   assertFalse(reader.isEof());
   reader.readLine();
   assertFalse(reader.isEof());
   reader.readLine();
   assertTrue(reader.isEof());
 }
Esempio n. 2
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());
 }
Esempio n. 3
0
 public void testEofReadCount() throws Exception {
   writeToPipe("abcdefghijklmnopqrstuvwxyz");
   output.close();
   assertFalse(reader.isEof());
   reader.read(10);
   assertFalse(reader.isEof());
   reader.read(16);
   assertFalse(reader.isEof());
   reader.read(1);
   assertTrue(reader.isEof());
 }
Esempio n. 4
0
 public static void copyBytes(InputStream input, OutputStream output) throws Exception {
   StreamReader reader = new StreamReader(input);
   while (!reader.isEof()) output.write(reader.readBytes(1000));
 }