Properties.java (setProperty): New method.
* java/util/Properties.java (setProperty): New method. (store): New method. From-SVN: r31855
This commit is contained in:
parent
5fa7f88c06
commit
bad196d78e
2 changed files with 102 additions and 86 deletions
|
@ -1,3 +1,8 @@
|
|||
2000-02-08 Tom Tromey <tromey@cygnus.com>
|
||||
|
||||
* java/util/Properties.java (setProperty): New method.
|
||||
(store): New method.
|
||||
|
||||
2000-02-07 Tom Tromey <tromey@cygnus.com>
|
||||
|
||||
* java/lang/Runtime.java (_load): Declare.
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// Properties - Property list representation.
|
||||
|
||||
/* Copyright (C) 1998, 1999 Red Hat, Inc.
|
||||
/* Copyright (C) 1998, 1999, 2000 Red Hat, Inc.
|
||||
|
||||
This file is part of libgcj.
|
||||
|
||||
|
@ -26,7 +26,7 @@ import java.io.PushbackReader;
|
|||
*/
|
||||
|
||||
/* Written using "Java Class Libraries", 2nd edition, ISBN 0-201-31002-3
|
||||
* Status: Complete to JDK 1.1.
|
||||
* Status: Complete to JDK 1.2.
|
||||
*/
|
||||
|
||||
public class Properties extends Hashtable
|
||||
|
@ -51,6 +51,11 @@ public class Properties extends Hashtable
|
|||
return r;
|
||||
}
|
||||
|
||||
public Object setProperty (String key, String value)
|
||||
{
|
||||
return put (key, value);
|
||||
}
|
||||
|
||||
public void list (PrintStream out)
|
||||
{
|
||||
Enumeration e = propertyNames ();
|
||||
|
@ -282,6 +287,18 @@ public class Properties extends Hashtable
|
|||
}
|
||||
|
||||
public synchronized void save (OutputStream out, String comment)
|
||||
{
|
||||
try
|
||||
{
|
||||
store (out, comment);
|
||||
}
|
||||
catch (IOException _)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public synchronized void store (OutputStream out, String comment)
|
||||
throws IOException
|
||||
{
|
||||
// Use a buffer because writing a single string through
|
||||
// OutputStreamWriter is fairly expensive.
|
||||
|
@ -289,8 +306,6 @@ public class Properties extends Hashtable
|
|||
= new BufferedWriter (new OutputStreamWriter (out));
|
||||
String newline = System.getProperty("line.separator");
|
||||
|
||||
try
|
||||
{
|
||||
if (comment != null)
|
||||
{
|
||||
// We just lose if COMMENT contains a newline. This is
|
||||
|
@ -373,8 +388,4 @@ public class Properties extends Hashtable
|
|||
|
||||
output.flush();
|
||||
}
|
||||
catch (IOException ignore)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue