Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package teln;
- import static java.lang.System.out;
- import java.io.IOException;
- import java.io.InputStream;
- public class StreamReader {
- private StreamReader() {
- }
- StreamReader(InputStream inputStream) throws IOException {
- printEachLine(inputStream);
- }
- private void printEachLine(InputStream inputStream) throws IOException {
- int foo = 0;
- char ch = 0;
- StringBuilder sb = new StringBuilder();
- out.println("lines..");
- boolean isEOL = false; //err, need to set this or get rid of it
- do {
- foo = inputStream.read();
- ch = (char) foo;
- //out.print(foo);
- sb.append(ch);
- if ((ch == 10)) {
- out.print(sb);
- sb = new StringBuilder();
- foo = inputStream.read();
- ch = (char) foo;
- sb.append(ch);
- if (ch != 13) {
- while ((255 > ch) && (ch >= 0)) {
- sb = new StringBuilder();
- foo = inputStream.read();
- ch = (char) foo;
- sb.append(ch);
- out.print(sb);
- }
- }
- sb.append(ch);
- }
- } while (!isEOL);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment