[英]Is there any way to create tar file without using third party libraries?
Can we create tar file without using third party libraries? 是否可以在不使用第三方库的情况下创建tar文件?
Thanks in advance. 提前致谢。
Regards, Sreenath Reddy 问候,斯雷纳斯·雷迪
There is no build-in support of the tar format in the standard library, no. 标准库中没有tar格式的内置支持。
But it is possible, yes. 但是有可能,是的。 The Wikipedia page about tar has a overview description of the format, and also links to more detailed descriptions (in the External links section).
有关tar的Wikipedia页面具有对该格式的概述,并且还链接到更详细的描述(在“外部链接”部分中)。 You should not need more to create a tar file with Java.
使用Java创建tar文件时,您不需要更多。 For convenience and performance, use a DataOutputStream on top of BufferedOutputStream and FileOutputStream (if you want to save this as a file).
为了方便起见和性能,请在BufferedOutputStream和FileOutputStream顶部使用DataOutputStream(如果要将其另存为文件)。
Of course, using an existing tar library is less error prone, easier to use and might even be faster. 当然,使用现有的tar库不太容易出错,更易于使用,甚至可能更快。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.