for (int i = 0; i < n; i++) {
random().nextBytes(buffer);
int size = 1 + random().nextInt(50);
// This test is turning random bytes into a string,
// this is asking for trouble.
CharsetDecoder decoder = IOUtils.CHARSET_UTF_8.newDecoder()
.onUnmappableCharacter(CodingErrorAction.REPLACE)
.onMalformedInput(CodingErrorAction.REPLACE);
String s = decoder.decode(ByteBuffer.wrap(buffer, 0, size)).toString();
array.append(s);
builder.append(s);
}
for (int i = 0; i < n; i++) {
random().nextBytes(buffer);
int size = 1 + random().nextInt(50);
// This test is turning random bytes into a string,
// this is asking for trouble.
CharsetDecoder decoder = IOUtils.CHARSET_UTF_8.newDecoder()
.onUnmappableCharacter(CodingErrorAction.REPLACE)
.onMalformedInput(CodingErrorAction.REPLACE);
String s = decoder.decode(ByteBuffer.wrap(buffer, 0, size)).toString();
array.append((CharSequence)s);
builder.append(s);
}
for (int i = 0; i < n; i++) {
random().nextBytes(buffer);
int size = 1 + random().nextInt(50);
// This test is turning random bytes into a string,
// this is asking for trouble.
CharsetDecoder decoder = IOUtils.CHARSET_UTF_8.newDecoder()
.onUnmappableCharacter(CodingErrorAction.REPLACE)
.onMalformedInput(CodingErrorAction.REPLACE);
String s = decoder.decode(ByteBuffer.wrap(buffer, 0, size)).toString();
for (int j = 0; j < s.length(); j++) {
array.append(s.charAt(j));
}
builder.append(s);
}