Merge pull request #13640 from pjfanning/patch-2
simplify StandardCharsets use
This commit is contained in:
commit
ba0f7855eb
|
@ -49,7 +49,7 @@ public class JavaInputStreamToXUnitTest {
|
||||||
final InputStream inputStream = new ByteArrayInputStream(originalString.getBytes());
|
final InputStream inputStream = new ByteArrayInputStream(originalString.getBytes());
|
||||||
|
|
||||||
final StringBuilder textBuilder = new StringBuilder();
|
final StringBuilder textBuilder = new StringBuilder();
|
||||||
try (Reader reader = new BufferedReader(new InputStreamReader(inputStream, Charset.forName(StandardCharsets.UTF_8.name())))) {
|
try (Reader reader = new BufferedReader(new InputStreamReader(inputStream, StandardCharsets.UTF_8))) {
|
||||||
int c;
|
int c;
|
||||||
while ((c = reader.read()) != -1) {
|
while ((c = reader.read()) != -1) {
|
||||||
textBuilder.append((char) c);
|
textBuilder.append((char) c);
|
||||||
|
@ -63,7 +63,7 @@ public class JavaInputStreamToXUnitTest {
|
||||||
final String originalString = randomAlphabetic(DEFAULT_SIZE);
|
final String originalString = randomAlphabetic(DEFAULT_SIZE);
|
||||||
final InputStream inputStream = new ByteArrayInputStream(originalString.getBytes());
|
final InputStream inputStream = new ByteArrayInputStream(originalString.getBytes());
|
||||||
|
|
||||||
final String text = new BufferedReader(new InputStreamReader(inputStream, Charset.forName(StandardCharsets.UTF_8.name())))
|
final String text = new BufferedReader(new InputStreamReader(inputStream, StandardCharsets.UTF_8))
|
||||||
.lines()
|
.lines()
|
||||||
.collect(Collectors.joining("\n"));
|
.collect(Collectors.joining("\n"));
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue