Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

blocking factor #7

Open
bkohler51 opened this issue Apr 11, 2013 · 2 comments
Open

blocking factor #7

bkohler51 opened this issue Apr 11, 2013 · 2 comments
Assignees

Comments

@bkohler51
Copy link

I am using Jtar in an application to tar a directory of files in windows. Analysis of the file created indicates that it is using a blocking factor of 3.
The application that extracts (tar -xfv filename) runs on a hpux box and apparently uses the default block size of 20 but is giving me the error "Tar: tape blocksize error". And when I use tar bxfv -b 3 filename, it works.
The problem is I can't change the extract application to use that factor so I need to know how to do it with Jtar on the front end so the default will work on the back end.
Thanks Bob

@bkohler51
Copy link
Author

Did some more research and found Jtar only writes with a factor of one. So I created my own copy of Jtar with a modification to TarOutputStream class that would allow a blocking factor.
Added
private int blockingFactor;
...changed
public void close() throws IOException {
closeCurrentEntry();
write(new byte[TarConstants.EOF_BLOCK]);
//Now pad it to a multiple of the blocking factor
int blkFacSize = TarConstants.DATA_BLOCK * blockingFactor;
write(new byte[blkFacSize - ((int) (bytesWritten % blkFacSize))]);
super.close();
}
...Added
public void setBlockingFactor(int factor) {
this.blockingFactor = factor;
}

@kamranzafar
Copy link
Owner

Thanks for your contribution, I will try to incorporate the blocking factor change in next release.

@ghost ghost assigned kamranzafar Apr 13, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants