projects
/
org.ibex.util.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
d8af5eb
)
update LineReader to use Baskets
author
crawshaw
<crawshaw@ibex.org>
Thu, 6 Jan 2005 15:58:43 +0000
(15:58 +0000)
committer
crawshaw
<crawshaw@ibex.org>
Thu, 6 Jan 2005 15:58:43 +0000
(15:58 +0000)
darcs-hash:
20050106155843
-2eb37-
163887bcb4cfc98bfa0cf98cc5b14d8d5d7530d8
.gz
src/org/ibex/util/LineReader.java
patch
|
blob
|
history
diff --git
a/src/org/ibex/util/LineReader.java
b/src/org/ibex/util/LineReader.java
index
ac784b8
..
75c18f0
100644
(file)
--- a/
src/org/ibex/util/LineReader.java
+++ b/
src/org/ibex/util/LineReader.java
@@
-3,15
+3,20
@@
// You may not use this file except in compliance with the License.
package org.ibex.util;
// 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;
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; }
public LineReader(Reader r) { this.r = r; }
@@
-30,12
+35,12
@@
public class LineReader {
return ret;
}
}
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;
int numread = r.read(buf, buflen, MAXBUF - buflen);
if (numread == -1) {
if (buflen == 0) return null;