X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;ds=sidebyside;f=src%2Forg%2Fibex%2Futil%2FLineReader.java;h=75c18f0f86590604e7d1066d121a1d4789d46f3a;hb=07c74b23c6b8389b748faf58821272e68fecee29;hp=429c21807a4d010be48b6708a1c68174d1fe5991;hpb=3a85dab61cef1346315ca40d3004f8772815127f;p=org.ibex.util.git diff --git a/src/org/ibex/util/LineReader.java b/src/org/ibex/util/LineReader.java index 429c218..75c18f0 100644 --- a/src/org/ibex/util/LineReader.java +++ b/src/org/ibex/util/LineReader.java @@ -1,13 +1,22 @@ +// Copyright 2000-2005 the Contributors, as shown in the revision logs. +// Licensed under the Apache Public Source License 2.0 ("the License"). +// You may not use this file except in compliance with the License. + package org.ibex.util; -import java.io.*; +import java.io.Reader; +import java.io.IOException; + +/** @author adam@ibex.org */ public class LineReader { private int MAXBUF = 1024 * 16; - char[] buf = new char[MAXBUF]; - int buflen = 0; - Reader r; - Vec pushback = new Vec(); + + private final Basket.Stack pushback = new Basket.Array(); + + private char[] buf = new char[MAXBUF]; + private int buflen = 0; + private Reader r; public LineReader(Reader r) { this.r = r; } @@ -26,12 +35,12 @@ public class LineReader { return ret; } } - if (buflen == MAXBUF) { - char[] buf2 = new char[MAXBUF*2]; - System.arraycopy(buf, 0, buf2, 0, buflen); - buf = buf2; - MAXBUF *= 2; - } + if (buflen == MAXBUF) { + char[] buf2 = new char[MAXBUF*2]; + System.arraycopy(buf, 0, buf2, 0, buflen); + buf = buf2; + MAXBUF *= 2; + } int numread = r.read(buf, buflen, MAXBUF - buflen); if (numread == -1) { if (buflen == 0) return null;