Hello,
is there an alternative to this package which I can use in my addon?
error
The package org.apache.commons.io.IOUtils should not be used
Hello,
is there an alternative to this package which I can use in my addon?
error
The package org.apache.commons.io.IOUtils should not be used
What dou you need from that package ?
This is my function which use the package
public void setCoverArt(@Nullable String coverArtUrl) {
if (!Objects.equals(coverArtUrl, this.coverArtUrl)) {
// TODO(miloit): Only handle images with complete uri atm.
if (!coverArtUrl.startsWith("http")) {
return;
}
try {
URL url = new URL(coverArtUrl);
URLConnection connection = url.openConnection();
coverArt = IOUtils.toByteArray(connection.getInputStream());
} catch (IOException ioe) {
coverArt = null;
}
this.coverArtDirty = true;
} else {
this.coverArtDirty = false;
}
}
Some of Java 11 helper methods might be helpful. Look maybe at BufferedReader
or InputStream#readAllBytes()
.