⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 bufferreader.java

📁 A framework written in Java for implementing high-level and dynamic languages, compiling them into J
💻 JAVA
字号:
package gnu.jemacs.buffer;import gnu.mapping.*;import java.io.*;import gnu.lists.CharBuffer;import gnu.text.*;public class BufferReader extends InPort{  CharBuffer content;  int rangeStart;  int rangeLength;  public BufferReader(CharBuffer content, Path path, int start, int count)  {    super(gnu.text.NullReader.nullReader, path);    this.content = content;    buffer = content.getArray();    rangeStart = start;    rangeLength = count;    if (start < content.gapStart)      {	pos = start;	limit = start + count;	if (limit > content.gapStart)	  limit = content.gapStart;      }    else      {	int gapSize = content.gapEnd - content.gapStart;	pos = start + gapSize;	int length = content.getArray().length;	limit = pos + count > length ? length : pos + count;      }  }  public int read ()  {    if (pos < limit)      return buffer[pos++];    if (limit == content.gapStart)      {	int gapSize = content.gapEnd - content.gapStart;	pos = content.gapEnd;	int count = rangeLength - (content.gapStart - rangeStart);	int length = content.getArray().length;	limit = pos + count > length ? length : pos + count;	if (pos < limit)	  return buffer[pos++];      }    return -1;  }  // int highestPos - is not used  // public synchronized void mark (int readAheadLimit) - seems OK.  // public boolean ready () -- seems OK  public void reset ()  throws IOException  {    if (readAheadLimit <= 0)      throw new IOException ("mark invalid");    if (pos >= content.gapEnd && markPos <= content.gapStart)      limit = content.gapEnd;    pos = markPos;    readAheadLimit = 0;  }  public int getLineNumber ()  {    throw new Error("BufferReader.getLineNumber - not implemented");  }  public int getColumnNumber ()  {    throw new Error("BufferReader.getColumnNumber - not implemented");  }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -