次のコードを使用して、プラグイン「A」のリソース フォルダーで使用可能なアイコンをローカル フォルダーにコピーしています。これは絶対にうまくいきます。他のプラグイン(プラグインB)のリソースフォルダからアイコンをコピーする方法があるかどうか知りたいです。プラグイン A のみでコピー ロジックを保持する必要があります。現在のプラグインから他のプラグインのリソース フォルダにアクセスする方法はありますか?
File objectDir = new File(directory + "/icons/");
if (!objectDir.exists()) {
objectDir.mkdirs();
}
InputStream inStream = null;
OutputStream outStream = null;
try {
File bfile = new File(directory + "/icons/validation.png");
inStream = this.getClass().getClassLoader().getResourceAsStream("/icons/viewAsHTML.png");
outStream = new FileOutputStream(bfile);
byte[] buffer = new byte[1024];
int length;
// copy the file content in bytes
while ((length = inStream.read(buffer)) > 0) {
outStream.write(buffer, 0, length);
}
inStream.close();
outStream.close();
System.out.println("File is copied successful!");
} catch (IOException e) {
e.printStackTrace();
}