[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[cdt-patch] Buffered the input stream
|
2002-10-22 Alain Magloire
* src/.../internal/parser/LinePositionInputStream.java:
We use a BufferedInputStream to limit the number of reads.
Index: LinePositionInputStream.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/parser/LinePositionInputStream.java,v
retrieving revision 1.1
diff -u -r1.1 LinePositionInputStream.java
--- LinePositionInputStream.java 26 Jun 2002 20:39:58 -0000 1.1
+++ LinePositionInputStream.java 22 Oct 2002 19:23:08 -0000
@@ -5,6 +5,7 @@
* All Rights Reserved.
*/
+import java.io.BufferedInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
@@ -18,7 +19,7 @@
public class LinePositionInputStream extends InputStream {
private List fLinePositions;
- private InputStream fInputStream;
+ private BufferedInputStream buffered;
private boolean fRRead;
private boolean fAddLine;
@@ -26,7 +27,7 @@
private int fCurrPosition;
public LinePositionInputStream(InputStream inputStream) throws IOException {
- fInputStream= inputStream;
+ buffered = new BufferedInputStream(inputStream);
fLinePositions= new ArrayList(30);
fAddLine= true;
fRRead= false;
@@ -34,7 +35,8 @@
}
public int read() throws IOException {
- int ch= fInputStream.read();
+
+ int ch = buffered.read();
if (fRRead && ch == '\n') {
fRRead= false;
} else {