home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Late Night VRML 2.0 with Java CD-ROM
/
code.zip
/
Ch13
/
nff
/
CommentStripperInputStream.java
< prev
next >
Wrap
Text File
|
1996-11-27
|
726b
|
32 lines
// Comment-stripping input
// Written by Bernie Roehl, November 1996
package nff;
import java.io.*;
public class CommentStripperInputStream extends FilterInputStream {
DataInputStream input;
public CommentStripperInputStream(DataInputStream in) {
super(in);
input = in;
}
public final String readLine() throws IOException {
String line;
do {
line = input.readLine();
if (line == null)
return line;
int comment_pos = line.indexOf("//");
if (comment_pos >= 0)
line = line.substring(0, comment_pos);
} while (line.length() == 0);
return line;
}
}