/[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.7 by mark, Fri Nov 8 13:42:47 2002 UTC revision 1.8 by mkoch, Sat Nov 16 15:22:16 2002 UTC
# Line 55  import gnu.java.nio.charset.Provider; Line 55  import gnu.java.nio.charset.Provider;
55   */   */
56  public abstract class Charset implements Comparable  public abstract class Charset implements Comparable
57  {  {
58      private static CharsetEncoder cachedEncoder;
59      private static CharsetDecoder cachedDecoder;
60      
61    private final String canonicalName;    private final String canonicalName;
62    private final String[] aliases;    private final String[] aliases;
63        
# Line 195  public abstract class Charset implements Line 198  public abstract class Charset implements
198    {    {
199      try      try
200        {        {
201          // TODO: cache encoders between sucessive invocations          if (cachedEncoder == null)
202          return newEncoder ().onMalformedInput (CodingErrorAction.REPLACE)            {
203                              .onUnmappableCharacter (CodingErrorAction.REPLACE)              cachedEncoder = newEncoder ()
204                              .encode (cb);                .onMalformedInput (CodingErrorAction.REPLACE)
205                  .onUnmappableCharacter (CodingErrorAction.REPLACE);
206              }
207                      
208            return cachedEncoder.encode (cb);
209        }        }
210      catch (CharacterCodingException e)      catch (CharacterCodingException e)
211        {        {
# Line 215  public abstract class Charset implements Line 222  public abstract class Charset implements
222    {    {
223      try      try
224       {       {
225          // TODO: cache encoders between sucessive invocations          if (cachedDecoder == null)
226          return newDecoder ().onMalformedInput (CodingErrorAction.REPLACE)            {
227                              .onUnmappableCharacter (CodingErrorAction.REPLACE)              cachedDecoder = newDecoder ()
228                              .decode (bb);                .onMalformedInput (CodingErrorAction.REPLACE)
229                  .onUnmappableCharacter (CodingErrorAction.REPLACE);
230              }
231            
232            return cachedDecoder.decode (bb);
233        }        }
234      catch (CharacterCodingException e)      catch (CharacterCodingException e)
235        {        {

Legend:
Removed from v.1.7  
changed lines
  Added in v.1.8

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