Tie up some loose ends, implementing methods that are useful but not yet implemented.

This commit is contained in:
Eric Scharff 2007-09-28 11:38:58 -06:00
parent 5691ec87f0
commit 43a2cb7cc5
4 changed files with 20 additions and 8 deletions

View File

@ -62,10 +62,7 @@ public final class Math {
return (int) Math.floor(v + 0.5);
}
public static double random() {
// TODO
throw new UnsupportedOperationException();
}
public static native double random();
public static native double floor(double v);

View File

@ -35,7 +35,7 @@ public abstract class Calendar {
}
public void setTime(Date date) {
// TODO
time = date.getTime();
}
public abstract void roll(int field, boolean up);

View File

@ -2,6 +2,7 @@ package java.util;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintStream;
import java.io.IOException;
public class Properties extends Hashtable {
@ -10,7 +11,16 @@ public class Properties extends Hashtable {
}
public void store(OutputStream out, String comment) throws IOException {
// TODO
PrintStream os = new PrintStream(out);
os.println("# " + comment);
for (Iterator it = entrySet().iterator();
it.hasNext();) {
Map.Entry entry = (Map.Entry)it.next();
os.print(entry.getKey());
os.print('=');
os.println(entry.getValue());
}
os.flush();
}
public String getProperty(String key) {

View File

@ -15,8 +15,10 @@ public class Inflater {
private int length;
private boolean needDictionary;
private boolean finished;
private final boolean nowrap;
public Inflater(boolean nowrap) {
this.nowrap = nowrap;
peer = make(nowrap);
}
@ -55,8 +57,11 @@ public class Inflater {
}
public void reset() {
// TODO
throw new UnsupportedOperationException();
dispose();
peer = make(nowrap);
input = null;
offset = length = 0;
needDictionary = finished = false;
}
public int inflate(byte[] output) throws DataFormatException {