/usr/share/doc/jflex/examples/zero-reader/FunkyReader.java is in jflex 1.6.1-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* JFlex ZeroReader example *
* *
* Copyright (C) 1998-2015 Gerwin Klein <lsf@jflex.de> *
* All rights reserved. *
* *
* License: BSD *
* *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
import java.io.Reader;
import java.io.IOException;
/**
* Reader that returns 0 chars read every once in a while.
*
* This is a demonstration of a problematics Reader that does not
* implement the Reader specification correctly. Do not use.
*/
public class FunkyReader extends Reader {
boolean do_zero;
Reader reader;
public FunkyReader(Reader r) {
this.reader = r;
}
public int read(char[] cbuf, int off, int len) throws IOException {
if (!do_zero) {
do_zero = true;
return reader.read(cbuf,off,Integer.min(10,len));
}
else {
do_zero = false;
return 0;
}
}
public void close() throws IOException {
reader.close();
}
}
|