From 4611c89dbed4a594441b42c9e7ef8480430fa588 Mon Sep 17 00:00:00 2001 From: Joel Dice Date: Tue, 6 Nov 2007 17:41:53 -0700 Subject: [PATCH] add a few classpath methods --- classpath/java/lang/String.java | 11 +++++++++++ classpath/java/lang/Thread.java | 4 ++++ classpath/java/util/Collection.java | 2 ++ 3 files changed, 17 insertions(+) diff --git a/classpath/java/lang/String.java b/classpath/java/lang/String.java index 340c591b87..880b2e14c1 100644 --- a/classpath/java/lang/String.java +++ b/classpath/java/lang/String.java @@ -1,5 +1,7 @@ package java.lang; +import java.io.UnsupportedEncodingException; + public final class String implements Comparable { private Object data; private int offset; @@ -30,6 +32,15 @@ public final class String implements Comparable { 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[]) { diff --git a/classpath/java/lang/Thread.java b/classpath/java/lang/Thread.java index 0dd5811f04..3937944d1d 100644 --- a/classpath/java/lang/Thread.java +++ b/classpath/java/lang/Thread.java @@ -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"); diff --git a/classpath/java/util/Collection.java b/classpath/java/util/Collection.java index c1ff4748f7..009e4d3fd6 100644 --- a/classpath/java/util/Collection.java +++ b/classpath/java/util/Collection.java @@ -3,6 +3,8 @@ package java.util; public interface Collection extends Iterable { public int size(); + public boolean isEmpty(); + public boolean contains(T element); public boolean add(T element);