import java.util.RandomAccess;
/**
- * ShiftJISデコードエラー情報を含む再利用可能な文字列。
- * デコードエラーを起こした箇所は代替文字{@link #ALTCHAR}で置き換えられる。
+ * デコードエラー情報を含む再利用可能な文字列。
+ *
+ * <p>デコードエラーを起こした箇所は代替文字{@link #ALTCHAR}で置き換えられる。
* マルチスレッドには非対応。
- * UCS-4コードポイントには未対応。
*/
public class DecodedContent
implements CharSequence,
int startPos, int endPos)
throws IndexOutOfBoundsException{
if(seq == null){
- this.rawContent.append(NULLTEXT, startPos, endPos);
+ this.rawContent.append(NULLTEXT);
}else if(seq instanceof DecodedContent){
append((DecodedContent) seq, startPos, endPos);
}else{
/**
* 文字列を追加する。
+ *
+ * @param str 追加される文字
+ * @param offset 追加される最初の char のインデックス
+ * @param len 追加される char の数
+ * @return thisオブジェクト
+ * @throws IndexOutOfBoundsException 範囲指定が不正。
+ */
+ public DecodedContent append(char[] str, int offset, int len)
+ throws IndexOutOfBoundsException{
+ if(str == null){
+ this.rawContent.append(NULLTEXT);
+ }else{
+ this.rawContent.append(str, offset, len);
+ }
+
+ return this;
+ }
+
+ /**
+ * 文字列を追加する。
* @param source 追加する文字列
* @param startPos 開始位置
* @param endPos 終了位置
int startPos, int endPos)
throws IndexOutOfBoundsException{
if(source == null){
- return append(NULLTEXT, startPos, endPos);
+ return append(NULLTEXT);
}
int gap = startPos - this.rawContent.length();
}
/**
- * 代替文字とともにデコードエラーを追加する。
+ * 代替文字とともに2バイトからなるデコードエラーを追加する。
+ *
+ * <p>主にシフトJISのUnmapエラーを想定。
+ *
* @param b1st 1バイト目の値
* @param b2nd 2バイト目の値
*/