We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 2fe1bb2 commit 1f1a53aCopy full SHA for 1f1a53a
lib/src/main/java/com/diffplug/spotless/FeatureClassLoader.java
@@ -101,11 +101,8 @@ public URL findResource(String name) {
101
102
private static ByteBuffer urlToByteBuffer(URL url) throws IOException {
103
ByteArrayOutputStream buffer = new ByteArrayOutputStream();
104
- int nRead;
105
- byte[] data = new byte[1024];
106
- InputStream inputStream = url.openStream();
107
- while ((nRead = inputStream.read(data, 0, data.length)) != -1) {
108
- buffer.write(data, 0, nRead);
+ try (InputStream inputStream = url.openStream()) {
+ inputStream.transferTo(buffer);
109
}
110
buffer.flush();
111
return ByteBuffer.wrap(buffer.toByteArray());
0 commit comments