* @param len 追加される char の数
* @return thisオブジェクト
* @throws IndexOutOfBoundsException 範囲指定が不正。
+ * @see StringBuffer#append(char[], int, int)
*/
public DecodedContent append(char[] str, int offset, int len)
throws IndexOutOfBoundsException{
* @param endPos 終了位置
* @return thisオブジェクト
* @throws IndexOutOfBoundsException 範囲指定が変。
+ * @see Appendable#append(CharSequence, int, int)
*/
public DecodedContent append(DecodedContent source,
int startPos, int endPos)
int oldLength = this.rawContent.length();
this.rawContent.append(source.rawContent, startPos, endPos);
- List<DecodeErrorInfo> sourceErrorList;
+
+ List<DecodeErrorInfo> srcErrList;
if(source.hasDecodeError()){
- sourceErrorList = source.decodeError;
+ srcErrList = source.decodeError;
}else{
return this;
}
- List<DecodeErrorInfo> targetErrorList;
- if(source != this) targetErrorList = this.decodeError;
- else targetErrorList = null;
+ List<DecodeErrorInfo> dstErrList;
+ if(source == this) dstErrList = null;
+ else dstErrList = this.decodeError;
int gap = startPos - oldLength;
- targetErrorList = appendGappedErrorInfo(sourceErrorList,
- startPos, endPos,
- targetErrorList,
- gap);
+ dstErrList = appendGappedErrorInfo(srcErrList,
+ startPos, endPos,
+ dstErrList,
+ gap);
- if(targetErrorList == null) return this;
- if(targetErrorList == this.decodeError) return this;
+ if(dstErrList == null) return this;
+ if(dstErrList == this.decodeError) return this;
if(this.decodeError == null){
- this.decodeError = targetErrorList;
+ this.decodeError = dstErrList;
}else{
- this.decodeError.addAll(targetErrorList);
+ this.decodeError.addAll(dstErrList);
}
return this;
seq = null;
content.append(seq);
assertEquals("abcdefnull", content.toString());
+ content.append(new DecodedContent("dec"));
+ assertEquals("abcdefnulldec", content.toString());
return;
}
assertEquals("23", content.toString());
content.init();
+ content.append((CharSequence)new DecodedContent("PQR"), 1, 3);
+ assertEquals("QR", content.toString());
+
+ content.init();
try{
content.append(seq, 3, 1);
fail();