17 String tmpDirString =
"tmpDir";
18 String tmpDirPath = ConfigProperties.getPropertyParam(
"dump_server") + tmpDirString +
"/";
19 String fileDir = ConfigProperties.getPropertyParam(
"dump_server");
21 File tmpDir1 =
new File(tmpDirPath.substring(0, tmpDirPath.length() - 1));
22 if (!tmpDir1.exists()) {
23 if (tmpDir1.mkdir()) {
25 System.out.println(
"Failed to create directory!");
29 URL link =
new URL(ConfigProperties.getPropertyParam(
"ts_server") +
"/repositories/" + repo +
"/statements?Accept=text/plain");
30 InputStream in =
new BufferedInputStream(link.openStream());
31 ByteArrayOutputStream out =
new ByteArrayOutputStream();
32 byte[] buf =
new byte[1024];
34 while (-1 != (n = in.read(buf))) {
39 byte[] response2 = out.toByteArray();
40 long currentTime = System.currentTimeMillis();
41 String fileName = tmpDirPath + String.valueOf(currentTime) +
".ttl";
42 FileOutputStream fos =
new FileOutputStream(fileName);
46 String compressedFile = fileDir + String.valueOf(currentTime) +
"_" + repo +
".tar.gz";
47 TarGZ.compressWithoutFolder(tmpDirPath, compressedFile, tmpDirString);
49 FileUtils.deleteDirectory(
new File(tmpDirPath));
51 return String.valueOf(currentTime) +
"_" + repo +
".tar.gz";
53 System.out.println(e.toString());
54 throw new IllegalStateException(e.toString());