0
我正在使用以下代碼將插件「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();
}
你所說的「插件」是什麼意思? – cahen 2013-04-23 12:22:34
我正在開發eclipse rcp插件項目。 – MIM 2013-04-23 12:42:30