public class UstarEntryStrategy extends V7TarEntryStrategy
V7TarEntryStrategy
to be able to write full
ustar Tar entry headers. In addition to the data in a v7 header, the ustar
header contains the following data:
Property | Comment |
---|---|
Version of the ustar header | This is set to 00 |
Owner name | The name of the user owning the entity that the Tar entry was created from. The maximum size of this field is 31 8-byte characters. |
Group name | The name of the group owning the entity that the Tar entry was created from. The maximum size of this field is 31 8-byte characters. |
Device major number | This is always set to 0000000 by this implementation. |
Device minor number | This is always set to 0000000 by this implementation. |
Name prefix | This is 155 additional bytes that can be prefixed to the entry name if it is longer than 99 characters. This gives a theoretical maximum path length of 255 characters, but since the split must occur at a slash, the actual maximum length is often shorter. |
Constructor and Description |
---|
UstarEntryStrategy()
Create a new strategy object that will use the platform's default
character encoding to encode text values in the Tar entries.
|
UstarEntryStrategy(Charset cs)
Create a new strategy object that will use the supplied charset for
encoding test values in the Tar entries.
|
Modifier and Type | Method and Description |
---|---|
protected byte[] |
getHeader(Object entity,
String fileName,
TarEntrySettings effectiveSettings,
long fileSize,
org.entityfs.EntityType entityType,
Date lastModified)
Override the inherited implementation to add ustar specific data.
|
protected void |
setFileNameInHeader(byte[] header,
String fileName)
Override the inherited implementation to be able to split long file names
between the prefix and the name fields.
|
addChecksumToHeader, getFileName, getTextEncodingCharset, goToNextBlockBoundary, writeDirectory, writeFile, writeFileFromStream, writeFileToArchive, zeroPadLeft
public UstarEntryStrategy()
UstarEntryStrategy(Charset)
public UstarEntryStrategy(Charset cs)
cs
- The charset.UstarEntryStrategy()
protected void setFileNameInHeader(byte[] header, String fileName) throws ArchiveEntryAddException
setFileNameInHeader
in class V7TarEntryStrategy
header
- The header to add the file name to.fileName
- The file name to add.ArchiveEntryAddException
- If the file name is too long.protected byte[] getHeader(Object entity, String fileName, TarEntrySettings effectiveSettings, long fileSize, org.entityfs.EntityType entityType, Date lastModified) throws ArchiveEntryAddException
getHeader
in class V7TarEntryStrategy
entity
- The entity that the Tar entry should represent. This may be
a file, a directory or an InputStream
.fileName
- The name of the entity.effectiveSettings
- Effective settings for the entry.fileSize
- If the entry is a file entry, this value contains the
file size in bytes.entityType
- The type of the entity being added.lastModified
- When the entity was last modified.V7TarEntryStrategy.addChecksumToHeader(byte[])
method may be used to calculate the
header's checksum when all data has been added to it.ArchiveEntryAddException
- If the entry cannot be created, for some
reason.