ICU-9267 Change buffer creation in unshapeLamAlef() function.

X-SVN-Rev: 31740
This commit is contained in:
Andy Heninger 2012-04-18 21:38:54 +00:00
parent 8a6937498f
commit 24d35f5311

View File

@ -1204,19 +1204,18 @@ abstract class CharsetRecog_sbcs extends CharsetRecognizer {
private byte[] unshapeLamAlef(byte[] inputBytes, int inputLen) {
ByteBuffer resultBigBuffer = ByteBuffer.allocate(inputLen*2);
ByteBuffer resultBuffer;
byte unshapedLamAlef[] = {(byte)0xb1, (byte)0x56};
for (int i=0; i<inputLen; i++){
if (isLamAlef(inputBytes[i]))
resultBigBuffer.put(unshapedLamAlef);
else
resultBigBuffer.put(inputBytes[i]);
}
resultBuffer = ByteBuffer.allocate(resultBigBuffer.position());
resultBuffer.put(resultBigBuffer.array(),0, resultBigBuffer.position());
return resultBuffer.array();
byte[] resultBuffer = new byte[resultBigBuffer.position()];
resultBigBuffer.position(0);
resultBigBuffer.get(resultBuffer);
return resultBuffer;
}
private boolean isLamAlef(byte b) {