InputStreamRules
SUGGESTION
Simplification
Suppression
Disable all rules by adding
-XepOpt:Refaster:NamePattern=^(?!InputStreamRules\$).*as compiler argument.
Table of contents
InputStreamTransferTo
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("InputStreamTransferTo")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!InputStreamRules\$InputStreamTransferTo).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
 long testInputStreamTransferTo() throws IOException {
-  return ByteStreams.copy(new ByteArrayInputStream(new byte[0]), new ByteArrayOutputStream());
+  return new ByteArrayInputStream(new byte[0]).transferTo(new ByteArrayOutputStream());
 }InputStreamReadAllBytes
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("InputStreamReadAllBytes")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!InputStreamRules\$InputStreamReadAllBytes).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
 byte[] testInputStreamReadAllBytes() throws IOException {
-  return ByteStreams.toByteArray(new ByteArrayInputStream(new byte[0]));
+  return new ByteArrayInputStream(new byte[0]).readAllBytes();
 }InputStreamReadNBytes
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("InputStreamReadNBytes")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!InputStreamRules\$InputStreamReadNBytes).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
 byte[] testInputStreamReadNBytes() throws IOException {
-  return ByteStreams.limit(new ByteArrayInputStream(new byte[0]), 0).readAllBytes();
+  return new ByteArrayInputStream(new byte[0]).readNBytes(0);
 }InputStreamSkipNBytes
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("InputStreamSkipNBytes")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!InputStreamRules\$InputStreamSkipNBytes).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
 void testInputStreamSkipNBytes() throws IOException {
-  ByteStreams.skipFully(new ByteArrayInputStream(new byte[0]), 0);
+  new ByteArrayInputStream(new byte[0]).skipNBytes(0);
 }