]> source.dussan.org Git - jackcess.git/commitdiff
do not rewrap CharBuffer
authorJames Ahlborn <jtahlborn@yahoo.com>
Sat, 30 Oct 2010 00:05:10 +0000 (00:05 +0000)
committerJames Ahlborn <jtahlborn@yahoo.com>
Sat, 30 Oct 2010 00:05:10 +0000 (00:05 +0000)
git-svn-id: https://svn.code.sf.net/p/jackcess/code/jackcess/trunk@493 f203690c-595d-4dc9-a70b-905162fa7fd2

src/java/com/healthmarketscience/jackcess/Column.java

index 666fa1e1a8fef62cf6d2f8aefb44053187f3f775..1eba8659dd4a347aff146951bd22ae393694de80 100644 (file)
@@ -1386,13 +1386,15 @@ public class Column implements Comparable<Column> {
 
   /**
    * @param text Text to encode
-   * @param db relevant db
+   * @param charset database charset
    * @return A buffer with the text encoded
    */
   public static ByteBuffer encodeUncompressedText(CharSequence text,
                                                   Charset charset)
   {
-    return charset.encode(CharBuffer.wrap(text));
+    CharBuffer cb = ((text instanceof CharBuffer) ? 
+                     (CharBuffer)text : CharBuffer.wrap(text));
+    return charset.encode(cb);
   }