mirror of
https://github.com/topjohnwu/jtar.git
synced 2024-11-26 21:00:35 +00:00
updated README
This commit is contained in:
parent
5ff6991e2b
commit
ac8a4c69cc
10
README.md
10
README.md
@ -22,15 +22,15 @@ Below are some examples of using jtar in applications
|
|||||||
TarOutputStream out = new TarOutputStream( new BufferedOutputStream( dest ) );
|
TarOutputStream out = new TarOutputStream( new BufferedOutputStream( dest ) );
|
||||||
|
|
||||||
// Files to tar
|
// Files to tar
|
||||||
File[] filesToTar=new File\[2\];
|
File[] filesToTar=new File[2];
|
||||||
filesToTar\[0\]=new File("c:/test/myfile1.txt");
|
filesToTar[0]=new File("c:/test/myfile1.txt");
|
||||||
filesToTar\[1\]=new File("c:/test/myfile2.txt");
|
filesToTar[1]=new File("c:/test/myfile2.txt");
|
||||||
|
|
||||||
for(File f:filesToTar){
|
for(File f:filesToTar){
|
||||||
out.putNextEntry(new TarEntry(f, f.getName()));
|
out.putNextEntry(new TarEntry(f, f.getName()));
|
||||||
BufferedInputStream origin = new BufferedInputStream(new FileInputStream( f ));
|
BufferedInputStream origin = new BufferedInputStream(new FileInputStream( f ));
|
||||||
int count;
|
int count;
|
||||||
byte data[] = new byte\[2048\];
|
byte data[] = new byte[2048];
|
||||||
|
|
||||||
while((count = origin.read(data)) != -1) {
|
while((count = origin.read(data)) != -1) {
|
||||||
out.write(data, 0, count);
|
out.write(data, 0, count);
|
||||||
@ -54,7 +54,7 @@ Below are some examples of using jtar in applications
|
|||||||
|
|
||||||
while((entry = tis.getNextEntry()) != null) {
|
while((entry = tis.getNextEntry()) != null) {
|
||||||
int count;
|
int count;
|
||||||
byte data[] = new byte\[2048\];
|
byte data[] = new byte[2048];
|
||||||
FileOutputStream fos = new FileOutputStream(destFolder + "/" + entry.getName());
|
FileOutputStream fos = new FileOutputStream(destFolder + "/" + entry.getName());
|
||||||
BufferedOutputStream dest = new BufferedOutputStream(fos);
|
BufferedOutputStream dest = new BufferedOutputStream(fos);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user