updated README

This commit is contained in:
Kamran 2012-09-14 00:14:26 +01:00
parent 5ff6991e2b
commit ac8a4c69cc

View File

@ -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);