From: <hag...@us...> - 2006-12-14 10:15:05
|
Revision: 2917 http://jnode.svn.sourceforge.net/jnode/?rev=2917&view=rev Author: hagar-wize Date: 2006-12-14 02:15:03 -0800 (Thu, 14 Dec 2006) Log Message: ----------- Classpath patches Modified Paths: -------------- trunk/core/src/classpath/gnu/gnu/java/nio/charset/ByteCharset.java Modified: trunk/core/src/classpath/gnu/gnu/java/nio/charset/ByteCharset.java =================================================================== --- trunk/core/src/classpath/gnu/gnu/java/nio/charset/ByteCharset.java 2006-12-14 10:09:53 UTC (rev 2916) +++ trunk/core/src/classpath/gnu/gnu/java/nio/charset/ByteCharset.java 2006-12-14 10:15:03 UTC (rev 2917) @@ -156,6 +156,22 @@ } } + public boolean canEncode(char c) + { + byte b = (c < lookup.length) ? lookup[c] : 0; + return b != 0 || c == 0; + } + + public boolean canEncode(CharSequence cs) + { + for (int i = 0; i < cs.length(); ++i) + { + if (! canEncode(cs.charAt(i))) + return false; + } + return true; + } + protected CoderResult encodeLoop (CharBuffer in, ByteBuffer out) { // TODO: Optimize this in the case in.hasArray() / out.hasArray() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |