- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
private void CopyFiles(String dirName) {
InputStream is = this.getClass().getResourceAsStream(
"/18.xslt");
OutputStream os;
try {
os = new FileOutputStream(dirName + "/18.xslt");
byte[] buffer = new byte[4096];
int length;
while ((length = is.read(buffer)) > 0) {
os.write(buffer, 0, length);
}
os.close();
is.close();
is = this.getClass().getResourceAsStream(
"/13_02.tif");
os = new FileOutputStream(dirName + "/13_02.tif");
while ((length = is.read(buffer)) > 0) {
os.write(buffer, 0, length);
}
os.close();
is.close();
is = this.getClass().getResourceAsStream("/13_02.xslt");
os = new FileOutputStream(dirName + "/13_02.xslt");
while ((length = is.read(buffer)) > 0) {
os.write(buffer, 0, length);
}
os.close();
is.close();
is = this.getClass().getResourceAsStream(
"/13_02_t.tif");
os = new FileOutputStream(dirName + "/13_02_t.tif");
while ((length = is.read(buffer)) > 0) {
os.write(buffer, 0, length);
}
os.close();
is.close();
is = this.getClass().getResourceAsStream(
"/13_02_t.xslt");
os = new FileOutputStream(dirName + "/13_02_t.xslt");
while ((length = is.read(buffer)) > 0) {
os.write(buffer, 0, length);
}
os.close();
is.close();
} catch (FileNotFoundException e1) {
e1.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
Правда, стоило бы цикл сделать пофайловый, а не писать для каждого файла отдельно открытие/закрытие/итд...