package bluej.runtime;

import java.io.IOException;
import java.io.InputStream;

import bluej.terminal.InputBuffer;


| BlueJ input stream. An input stream filter to process "End of file" |* signals (CTRL-Z or CTRL-D) from a terminal * * @author Davin McCall * @version $Id: BJInputStream.java 7142 2010-02-17 23:47:00Z davmac $ */ public class BJInputStream extends InputStream{ private InputStream source; | |int buffoffset = 0; | |boolean endOfLine = false; | |boolean exOnEOL = false; | |/** | Construct a BJ | @param source The source input stream, generally System.in | BJInputStream(InputStream source) { this.source = source; } public int read() throws IOException { ExecServer.showTerminalOnInput(); if (exOnEOL && endOfLine) throw new IOException(); int n = source.read(); if (n == InputBuffer.EOF_CHAR) return -1; if (exOnEOL && n == '\n') endOfLine = true; return n; } public int read(byte [] b, int off, int len) throws IOException { ExecServer.showTerminalOnInput(); exOnEOL = true; int n = super.read(b, off, len); exOnEOL = false; endOfLine = false; return n; } public int available() throws IOException { return source.available(); } }

.   read
.   read
.   available




67 neLoCode + 7 LoComm