--- /dev/null
+public class BufferedInputStream extends InputStream {
+ InputStream in;
+ public BufferedInputStream(InputStream in) {
+ this.in=in;
+ }
+ public int read() {
+ return in.read();
+ }
+
+ public int read(byte[] b) {
+ return in.read(b);
+ }
+}
--- /dev/null
+public class BufferedOutputStream {
+
+}
--- /dev/null
+public class BufferedWriter extends Writer {
+ Writer out;
+
+ public void write(String s) {
+ out.write(s);
+ }
+
+ public void newLine() {
+ out.write("\n");
+ }
+
+}
--- /dev/null
+public class Character {
+
+ public static int digit(char ch, int radix) {
+ if (ch>='0'&&ch<='9')
+ return ch-'0';
+ else if (ch>='a'&&ch<='z') {
+ int val=(ch-'a')+10;
+ if (val<radix)
+ return val;
+ } else if (ch>='A'&&ch<='Z') {
+ int val=(ch-'A')+10;
+ if (val<radix)
+ return val;
+ }
+ return -1;
+ }
+}
--- /dev/null
+public class Date {
+ public Date() {}
+
+
+}
--- /dev/null
+public class Dictionary {
+
+}
--- /dev/null
+public class Enumeration {
+
+}
-public class FileInputStream {
+public class FileInputStream extends InputStream {
private int fd;
public FileInputStream(String pathname) {
--- /dev/null
+public class InputStream {
+ public int read() {
+ }
+ public int read(byte[] b) {
+ }
+}
external flag IOPending;
/* File Descriptor */
int fd;
+ private SocketInputStream sin;
public Socket() {
+ sin=new SocketInputStream(this);
+
+ }
+
+ public InputStream getInputStream() {
+ return sin;
}
public Socket(String host, int port) {
--- /dev/null
+public class SocketInputStream {
+ Socket s;
+ public SocketInputStream(Socket s) {
+ this.s=s;
+ }
+
+ public int read() {
+ byte[] x=new byte[1];
+ int len=s.read(x);
+ if (len==0)
+ return -1;
+ else return x[1];
+ }
+}
value[i]=strbuf.value[i];
}
+ public boolean endsWith(String suffix) {
+ return regionMatches(count - suffix.count, suffix, 0, suffix.count);
+ }
+
+
+ public String substring(int beginIndex) {
+ return substring(beginIndex, this.count);
+ }
+
public String subString(int beginIndex, int endIndex) {
+ return substring(beginIndex, endIndex);
+ }
+
+ public String substring(int beginIndex, int endIndex) {
String str=new String();
if (beginIndex>this.count||endIndex>this.count||beginIndex>endIndex) {
// FIXME
return -1;
}
+ public int lastIndexOf(String str, int fromIndex) {
+ int k=count-str.count;
+ if (k>fromIndex)
+ k=fromIndex;
+ for(;k>=0;k--) {
+ if (regionMatches(fromIndex, str, 0, str.count))
+ return k;
+ }
+ return -1;
+ }
+
+ public int lastIndexOf(String str) {
+ return lastIndexOf(str, count-str.count);
+ }
+
public boolean startsWith(String str) {
return regionMatches(0, str, 0, str.count);
}
+ public boolean startsWith(String str, int toffset) {
+ return regionMatches(toffset, str, 0, str.count);
+ }
+
public boolean regionMatches(int toffset, String other, int ooffset, int len) {
if (toffset<0 || ooffset <0 || (toffset+len)>count || (ooffset+len)>other.count)
return false;
return o.toString();
}
+ public static String valueOf(char c) {
+ char ar[]=new char[1];
+ ar[0]=c;
+ return new String(ar);
+ }
+
public static String valueOf(int x) {
int length=0;
int tmp;
}
return true;
}
+
+ public boolean equalsIgnoreCase(String s) {
+ if (s.count!=count)
+ return false;
+ for(int i=0;i<count;i++) {
+ char l=s.value[i+s.offset];
+ char r=value[i+offset];
+ if (l>='a'&&l<='z')
+ l+='A'-'a';
+ if (r>='a'&&r<='z')
+ r+='A'-'a';
+ if (l!=r)
+ return false;
+ }
+ return true;
+ }
}
return value[x];
}
- public void append(String s) {
+ public StringBuffer append(char c) {
+ return append(String.valueOf(c));
+ }
+
+ public StringBuffer append(String s) {
if ((s.count+count)>value.length) {
// Need to allocate
char newvalue[]=new char[s.count+count+16]; //16 is DEFAULTSIZE
}
count+=s.count;
}
+ return this;
}
- public void append(StringBuffer s) {
+ public StringBuffer append(StringBuffer s) {
if ((s.count+count)>value.length) {
// Need to allocate
char newvalue[]=new char[s.count+count+16]; //16 is DEFAULTSIZE
}
count+=s.count;
}
+ return this;
}
public String toString() {
--- /dev/null
+public class Vector {
+ Object[] array;
+ int size;
+ int capacityIncrement;
+
+ public Vector() {
+ capacityIncrement=0;
+ size=0;
+ array=new Object[10];
+ }
+
+ public void clear() {
+ size=0;
+ array=new Object[10];
+ }
+
+ public int indexOf(Object elem) {
+ return indexOf(elem, 0);
+ }
+
+ public int indexOf(Object elem, int index) {
+ for(int i=index;i<size;i++) {
+ if (elem.equals(array[i]))
+ return i;
+ }
+ return -1;
+ }
+
+ public Object elementAt(int index) {
+ if (index<0 || index >=size) {
+ System.printString("Illegal Vector.elementAt");
+ return null;
+ }
+ return array[index];
+ }
+
+ public void setElementAt(Object obj, int index) {
+ if (index>=0 && index <size)
+ array[index]=obj;
+ else
+ System.printString("Illegal setElementAt");
+ }
+
+ private ensureCapacity(int minCapacity) {
+ if (minCapacity>array.length) {
+ int newsize;
+ if (capacityIncrement<=0)
+ newsize=array.length*2;
+ else
+ newsize=array.length+capacityIncrement;
+ if (newsize<minCapacity)
+ newsize=minCapacity;
+ Object [] newarray=new Object[minCapacity];
+ for(int i=0;i<size;i++)
+ newarray[i]=array[i];
+ array=newarray;
+ }
+ }
+
+ public int size() {
+ return size;
+ }
+
+ public Enumeration elements() {
+ System.printString("Vector.elements not implemented");
+ }
+
+ public void addElement(Object obj) {
+ if (size==array.length) {
+ ensureCapacity(size+1);
+ }
+ array[size++]=obj;
+ }
+
+ public void removeElementAt(int index) {
+ if (index<0||index>=size)
+ System.printString("Illegal remove");
+ for(int i=index;i<(size-1);i++) {
+ array[i]=array[i+1];
+ }
+ size--;
+ }
+}
--- /dev/null
+public class Writer {
+
+ public void write(String s) {
+ }
+
+ public void write(String s, int off, int len) {
+ write(s.substring(off, off+len));
+ }
+}