/[classpath]/classpath/java/nio/charset/Charset.java
ViewVC logotype

Diff of /classpath/java/nio/charset/Charset.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.17 by smarothy, Wed Apr 13 13:19:53 2005 UTC revision 1.18 by smarothy, Tue Apr 19 22:40:22 2005 UTC
# Line 59  import java.util.TreeMap; Line 59  import java.util.TreeMap;
59  /**  /**
60   * @author Jesse Rosenstock   * @author Jesse Rosenstock
61   * @since 1.4   * @since 1.4
62     * @status updated to 1.5
63   */   */
64  public abstract class Charset implements Comparable  public abstract class Charset implements Comparable
65  {  {
# Line 116  public abstract class Charset implements Line 117  public abstract class Charset implements
117        }        }
118    }    }
119    
120      /**
121       * Returns the system default charset.
122       *
123       * This may be set by the user or VM with the file.encoding
124       * property.
125       */
126      public static Charset defaultCharset()
127      {
128        String encoding;
129        try
130          {
131            encoding = System.getProperty("file.encoding");
132          } catch(SecurityException e) {
133            encoding = "ISO-8859-1";
134          } catch(IllegalArgumentException e) {
135            encoding = "ISO-8859-1";
136          }
137    
138        try
139          {
140            return forName(encoding);
141          } catch(UnsupportedCharsetException e) {
142          } catch(IllegalCharsetNameException e) {
143          } catch(IllegalArgumentException e) {
144          }
145        throw new IllegalStateException("Can't get default charset!");
146      }
147    
148    public static boolean isSupported (String charsetName)    public static boolean isSupported (String charsetName)
149    {    {
150      return charsetForName (charsetName) != null;      return charsetForName (charsetName) != null;

Legend:
Removed from v.1.17  
changed lines
  Added in v.1.18

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26