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 Stringstatic final Stringstatic final intstatic final Stringstatic final intstatic final intstatic final intstatic final intFields inherited from class javolution.io.Struct
MAXIMUM_ALIGNMENT -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionjavolution.io.Struct.Unsigned32checksum()Returns the member of the struct containing the checksum.static voidfill(WritableByteChannel writableByteChannel) Fills suppliedWritableByteChannelwith a placeholder header.static UnixFSDataHeaderloadHeader(ReadableByteChannel channel, String magic) Reads aUnixFSDataHeaderfrom aReadableByteChannel.Sets the default values of thisUnixFSDataHeader.Sets the default values of thisUnixFSDataHeader.Sets the default values of thisUnixFSDataHeader.voidwriteHeader(UnixFSChecksumAlgorithm algorithm, WritableByteChannel writableByteChannel) Writes thisUnixFSDataHeaderto 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, writeBitsMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods 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.CheckableReturns 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 theByteBufferreturned byUnixFSChecksumAlgorithm.Checkable.contentsToCheck().- Specified by:
checksumin interfaceUnixFSChecksumAlgorithm.Checkable- Returns:
- the checksum member
-
fill
Fills suppliedWritableByteChannelwith a placeholder header.- Parameters:
writableByteChannel- the channel to write- Throws:
IOException
-
writeHeader
public void writeHeader(UnixFSChecksumAlgorithm algorithm, WritableByteChannel writableByteChannel) throws IOException Writes thisUnixFSDataHeaderto 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 aUnixFSDataHeaderfrom aReadableByteChannel.- Parameters:
channel- the channelmagic- the expected magic value- Returns:
- the
UnixFSDataHeader - Throws:
IOException
-