//
public static String readString (final byte[] data, final int pos,
final int length, final String encoding)
throws EncodingException
{
final Encoding enc;
if ("UTF-16".equals(encoding))
{
enc = EncodingRegistry.getInstance().getEncoding("UTF-16LE");
}
else
{
enc = EncodingRegistry.getInstance().getEncoding(encoding);
}
// Log.debug ("Encoding: " + enc);
final ByteBuffer byteBuffer = new ByteBuffer(data, pos, length);
final CodePointBuffer cp = enc.decode(byteBuffer, null);
return Utf16LE.getInstance().encodeString(cp);
}