- int length = -1;
- for(int pos = 0; pos < maxlen; pos++){
- byte ch = this.textArray[pos];
- if(ch == TERMINATOR){
- length = pos;
- break;
- }
- }
- if(length < 0) length = maxlen;
-
- this.textBuffer.rewind();
- this.textBuffer.limit(length);
- this.charBuffer.clear();
- CoderResult decResult =
- this.decoder.decode(this.textBuffer, this.charBuffer, true);
- if( ! decResult.isUnderflow() || decResult.isError()){
- throw new MmdFormatException("illegal character encoding",
- this.source.getPosition() );
- }
-
- this.charBuffer.flip();
- String result = this.charBuffer.toString();
-
- if(result.indexOf(UCSYEN) >= 0){
- result = result.replace(UCSYEN, SJISYEN);
- }