628 |
ByteBuffer bbuf = cse.encode(CharBuffer.wrap(value, offset, count)); |
ByteBuffer bbuf = cse.encode(CharBuffer.wrap(value, offset, count)); |
629 |
if(bbuf.hasArray()) |
if(bbuf.hasArray()) |
630 |
return bbuf.array(); |
return bbuf.array(); |
631 |
|
|
632 |
// Doubt this will happen. But just in case. |
// Doubt this will happen. But just in case. |
633 |
byte[] bytes = new byte[bbuf.remaining()]; |
byte[] bytes = new byte[bbuf.remaining()]; |
634 |
bbuf.get(bytes); |
bbuf.get(bytes); |
635 |
return bytes; |
return bytes; |
636 |
|
} |
637 |
} catch(IllegalCharsetNameException e){ |
catch(IllegalCharsetNameException e) |
638 |
throw new UnsupportedEncodingException("Encoding: "+enc+ |
{ |
639 |
" not found."); |
throw new UnsupportedEncodingException("Encoding: " + enc |
640 |
} catch(UnsupportedCharsetException e){ |
+ " not found."); |
641 |
throw new UnsupportedEncodingException("Encoding: "+enc+ |
} |
642 |
" not found."); |
catch(UnsupportedCharsetException e) |
643 |
} catch(CharacterCodingException e){ |
{ |
644 |
// XXX - Ignore coding exceptions? They shouldn't really happen. |
throw new UnsupportedEncodingException("Encoding: " + enc |
645 |
return null; |
+ " not found."); |
646 |
|
} |
647 |
|
catch(CharacterCodingException e) |
648 |
|
{ |
649 |
|
// This shouldn't ever happen. |
650 |
|
throw (InternalError) new InternalError().initCause(e); |
651 |
} |
} |
652 |
} |
} |
653 |
|
|