Class UnixFSDataHeader
java.lang.Object
javolution.io.Struct
dev.getelements.elements.rt.transact.unix.UnixFSDataHeader
- All Implemented Interfaces:
UnixFSChecksumAlgorithm.Checkable
public class UnixFSDataHeader
extends javolution.io.Struct
implements UnixFSChecksumAlgorithm.Checkable
-
Nested Class Summary
Nested classes/interfaces inherited from class javolution.io.Struct
javolution.io.Struct.BitField, javolution.io.Struct.Bool, javolution.io.Struct.Enum16<T extends Enum<T>>, javolution.io.Struct.Enum32<T extends Enum<T>>, javolution.io.Struct.Enum64<T extends Enum<T>>, javolution.io.Struct.Enum8<T extends Enum<T>>, javolution.io.Struct.Float32, javolution.io.Struct.Float64, javolution.io.Struct.Member, javolution.io.Struct.Reference32<S extends javolution.io.Struct>, javolution.io.Struct.Reference64<S extends javolution.io.Struct>, javolution.io.Struct.Signed16, javolution.io.Struct.Signed32, javolution.io.Struct.Signed64, javolution.io.Struct.Signed8, javolution.io.Struct.Unsigned16, javolution.io.Struct.Unsigned32, javolution.io.Struct.Unsigned8, javolution.io.Struct.UTF8String
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
static final String
static final int
static final String
static final int
static final int
static final int
static final int
Fields inherited from class javolution.io.Struct
MAXIMUM_ALIGNMENT
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionjavolution.io.Struct.Unsigned32
checksum()
Returns the member of the struct containing the checksum.static void
fill
(WritableByteChannel writableByteChannel) Fills suppliedWritableByteChannel
with a placeholder header.static UnixFSDataHeader
loadHeader
(ReadableByteChannel channel, String magic) Reads aUnixFSDataHeader
from aReadableByteChannel
.Sets the default values of thisUnixFSDataHeader
.Sets the default values of thisUnixFSDataHeader
.Sets the default values of thisUnixFSDataHeader
.void
writeHeader
(UnixFSChecksumAlgorithm algorithm, WritableByteChannel writableByteChannel) Writes thisUnixFSDataHeader
to disk.Methods inherited from class javolution.io.Struct
address, array, array, array, array, array, array, array, byteOrder, getByteBuffer, getByteBufferPosition, inner, isPacked, isUnion, outer, read, readBits, setByteBuffer, setByteBufferPosition, size, toString, write, writeBits
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface dev.getelements.elements.rt.transact.unix.UnixFSChecksumAlgorithm.Checkable
contentsToCheck
-
Field Details
-
TASK_MAGIC
- See Also:
-
REVERSE_PATH_MAGIC
- See Also:
-
RESOURCE_CONTENTS_MAGIC
- See Also:
-
VERSION_MAJOR_1
public static final int VERSION_MAJOR_1- See Also:
-
VERSION_MINOR_0
public static final int VERSION_MINOR_0- See Also:
-
VERSION_MAJOR_CURRENT
public static final int VERSION_MAJOR_CURRENT- See Also:
-
VERSION_MINOR_CURRENT
public static final int VERSION_MINOR_CURRENT- See Also:
-
SIZE
public static final int SIZE
-
-
Constructor Details
-
UnixFSDataHeader
public UnixFSDataHeader()
-
-
Method Details
-
setTaskDefaults
Sets the default values of thisUnixFSDataHeader
.- Returns:
- this instance
-
setResourceContentsDefaults
Sets the default values of thisUnixFSDataHeader
.- Returns:
- this instance
-
setReversePathDefaults
Sets the default values of thisUnixFSDataHeader
.- Returns:
- this instance
-
checksum
public javolution.io.Struct.Unsigned32 checksum()Description copied from interface:UnixFSChecksumAlgorithm.Checkable
Returns the member of the struct containing the checksum. Calculation presumes that for verification this member will be set to zero before calculating the checksum, and that this value will be skipped when verifying the checksum. Additionally, the checker and validator both assume that this member falls somewhere inside theByteBuffer
returned byUnixFSChecksumAlgorithm.Checkable.contentsToCheck()
.- Specified by:
checksum
in interfaceUnixFSChecksumAlgorithm.Checkable
- Returns:
- the checksum member
-
fill
Fills suppliedWritableByteChannel
with a placeholder header.- Parameters:
writableByteChannel
- the channel to write- Throws:
IOException
-
writeHeader
public void writeHeader(UnixFSChecksumAlgorithm algorithm, WritableByteChannel writableByteChannel) throws IOException Writes thisUnixFSDataHeader
to disk.- Parameters:
algorithm
- the algorithm to use when writing the header.writableByteChannel
- the channel- Throws:
IOException
-
loadHeader
public static UnixFSDataHeader loadHeader(ReadableByteChannel channel, String magic) throws IOException Reads aUnixFSDataHeader
from aReadableByteChannel
.- Parameters:
channel
- the channelmagic
- the expected magic value- Returns:
- the
UnixFSDataHeader
- Throws:
IOException
-