2024年2月3日发(作者:)
} else if (head[0]==-2 && head[1]==-1) {
inputCode = "UTF-16BE"; } else { left0 = head; counter++; } } while((len=(buffer)) == segmentSize) { //to check the value of len// n("len = " + len); int i = segmentSize - 1; if ("UTF-16LE".equals(inputCode)) { while (i>-1) { if ((buffer[i-1] >= 0 && buffer[i-1] <= 127) && buffer[i] ==0) { break;} i--; if (i==0) { //报错 n("File Segmentation Failed. Failed to find an " + "ASCII character(0x0000-0x0009) in a segment size of "+ segmentSize +" bytesn"+"Plese adjust the segmentation size."); break; } }// i = segmentSpliter(buffer,"(buffer[i-1] >= 0 || buffer[i-1] <= 127) "// + "&& (buffer[i]==0)"); }else if ("UTF-16BE".equals(inputCode)) { while (i>-1) { if ((buffer[i] >= 0 && buffer[i] <= 127) && buffer[i-1] ==0) { break;} i--; if (i==0) { //报错 n("File Segmentation Failed. Failed to find an " + "ASCII character(0x0000-0x0009) in a segment size of "+ segmentSize +" bytesn"+"Plese adjust the segmentation size."); break; } } }else {// the following segmentation method is not suitable for UTF-16 or UTF-32
// since they are not compatible with ASCII code
while (i>-1) { if (buffer[i] <= 127 && buffer[i] >= 0) { break;} i--; if (i==0) { //报错 n("File Segmentation Failed. Failed to find an " + "ASCII character(0-127) in a segment size of "+ segmentSize +" bytesn"+"Plese adjust the segmentation size."); break; } } } validBuffer = (buffer, i+1); if (counter%2==0){ left0 = Range(buffer,i+1,segmentSize); combined = concat(left1,validBuffer); left1 = null; } else { left1 = Range(buffer,i+1,segmentSize); combined = concat(left0,validBuffer); left0 = null; } counter++; converted = realConvert2(combined,); (converted); } //for the end part of the document //can't use len=(buffer) since buffer has been read into in the while loop for the last time. if(len < segmentSize) { //to check the value of len n("len = " + len); if (len>0) { validBuffer = (buffer, len); } else { //in case the file length is the multiple of 8 //in this case, the length of last segment will be 0 //only need to write what's in the left0 or left1 validBuffer = null; }
本文发布于:2024-02-03 15:08:20,感谢您对本站的认可!
本文链接:https://www.4u4v.net/it/170694410150713.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
留言与评论(共有 0 条评论) |