add a few classpath methods

This commit is contained in:
Joel Dice 2007-11-06 17:41:53 -07:00
parent 76d876c039
commit 4611c89dbe
3 changed files with 17 additions and 0 deletions

View File

@ -1,5 +1,7 @@
package java.lang;
import java.io.UnsupportedEncodingException;
public final class String implements Comparable<String> {
private Object data;
private int offset;
@ -30,6 +32,15 @@ public final class String implements Comparable<String> {
this(data, 0, data.length);
}
public String(byte[] data, String charset)
throws UnsupportedEncodingException
{
this(data);
if (! charset.equals("US-ASCII")) {
throw new UnsupportedEncodingException(charset);
}
}
private String(Object data, int offset, int length, boolean copy) {
int l;
if (data instanceof char[]) {

View File

@ -29,6 +29,10 @@ public class Thread implements Runnable {
classLoader = current.classLoader;
}
public Thread(Runnable task, String name) {
this(task);
}
public synchronized void start() {
if (peer != 0) {
throw new IllegalStateException("thread already started");

View File

@ -3,6 +3,8 @@ package java.util;
public interface Collection<T> extends Iterable<T> {
public int size();
public boolean isEmpty();
public boolean contains(T element);
public boolean add(T element);