Class MarshaledResponseBody.SecureFile
java.lang.Object
com.soklet.MarshaledResponseBody.SecureFile
- All Implemented Interfaces:
MarshaledResponseBody
- Enclosing interface:
MarshaledResponseBody
@ThreadSafe
public static final class MarshaledResponseBody.SecureFile
extends Object
implements MarshaledResponseBody
A static-file body acquired under the helper's trusted immutable-root contract.
Soklet creates these descriptors for
StaticFiles; an application cannot construct one
directly. The opened channel is owned by the transport for the duration of delivery.
Custom transports must use openChannel(), apply getOffset() and getCount(),
and close the channel after delivery or failure. A transport that cannot handle this descriptor
must reject it; opening the path separately loses the helper's root and file validation.
- Author:
- Mark Allen
-
Nested Class Summary
Nested classes/interfaces inherited from interface MarshaledResponseBody
MarshaledResponseBody.ByteBuffer, MarshaledResponseBody.Bytes, MarshaledResponseBody.File, MarshaledResponseBody.FileChannel, MarshaledResponseBody.SecureFileModifier and TypeInterfaceDescriptionstatic final classA finalized response body backed by aByteBuffer.static final classA finalized response body backed by a byte array.static final classA finalized response body backed by a file path.static final classA finalized response body backed by aFileChannel.static final classA static-file body acquired under the helper's trusted immutable-root contract. -
Method Summary
-
Method Details
-
openChannel
Opens the approved file after validating the captured root and expected file metadata. The immutable-root contract ofStaticFilesapplies to every acquisition. The caller must close the returned channel.- Returns:
- an open channel for the response body
- Throws:
IOException- if a change is detected or acquisition fails
-
getOffset
-
getCount
-
getLength
Description copied from interface:MarshaledResponseBodyThe number of bytes this body will write.- Specified by:
getLengthin interfaceMarshaledResponseBody- Returns:
- the number of bytes to send
-