📄 commandreader.java
字号:
// Decompiled by Jad v1.5.8e2. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://kpdus.tripod.com/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi space
// Source File Name: CommandReader.java
package org.gudy.azureus2.ui.console;
import java.io.IOException;
import java.io.Reader;
import java.util.List;
import java.util.Vector;
public class CommandReader extends Reader
{
private final int ENTER = 0;
private final int TAB = 1;
private final int QUOTE = 3;
private final int ESCAPE = 4;
private final int NONQUOTEDESCAPE = 5;
private Reader in;
public CommandReader(Reader _in)
{
in = _in;
}
private void ensureOpen()
throws IOException
{
if (in == null)
throw new IOException("Stream closed");
else
return;
}
public void close()
throws IOException
{
synchronized (lock)
{
if (in != null)
{
in.close();
in = null;
}
}
}
public int read()
throws IOException
{
Object obj = lock;
JVM INSTR monitorenter ;
ensureOpen();
return in.read();
Exception exception;
exception;
throw exception;
}
public int read(char cbuf[], int off, int len)
throws IOException
{
Object obj = lock;
JVM INSTR monitorenter ;
ensureOpen();
return in.read(cbuf, off, len);
Exception exception;
exception;
throw exception;
}
public String readLine()
throws IOException
{
Object obj = lock;
JVM INSTR monitorenter ;
StringBuffer line;
ensureOpen();
line = new StringBuffer();
int ch;
while ((char)(ch = in.read()) != '\n')
{
if (ch == -1)
throw new IOException("stream closed");
line.append((char)ch);
}
return line.toString().trim();
Exception exception;
exception;
throw exception;
}
public List parseCommandLine(String commandLine)
{
StringBuffer current = new StringBuffer();
Vector args = new Vector();
boolean allowEmpty = false;
boolean bailout = commandLine.length() == 0;
int index = 0;
int state = 0;
do
if (!bailout)
{
int ch = commandLine.charAt(index++);
bailout = index == commandLine.length();
char c = (char)ch;
switch (state)
{
case 0: // '\0'
switch (c)
{
case 34: // '"'
state = 3;
break;
case 92: // '\\'
state = 5;
break;
default:
current.append(c);
break;
case 13: // '\r'
break;
}
if (state == 0 && (c == ' ' || bailout))
{
String arg = current.toString().trim();
if (arg.length() > 0 || allowEmpty)
{
args.addElement(arg);
allowEmpty = false;
}
current = new StringBuffer();
}
break;
case 3: // '\003'
switch (c)
{
case 34: // '"'
allowEmpty = true;
state = 0;
break;
case 92: // '\\'
state = 4;
break;
default:
current.append(c);
break;
}
break;
case 4: // '\004'
switch (c)
{
case 110: // 'n'
c = '\n';
break;
case 114: // 'r'
c = '\r';
break;
case 116: // 't'
c = '\t';
break;
case 98: // 'b'
c = '\b';
break;
case 102: // 'f'
c = '\f';
break;
default:
current.append('\\');
break;
}
state = 3;
current.append(c);
break;
case 5: // '\005'
switch (c)
{
case 59: // ';'
state = 0;
current.append(c);
break;
default:
state = 0;
current.append('\\');
current.append(c);
break;
}
break;
}
} else
{
if (state == 0 && (current.toString().trim().length() > 0 || allowEmpty))
{
String arg = current.toString().trim();
args.addElement(arg);
}
return args;
}
while (true);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -