pub struct PlaceholderDataBox { /* private fields */ }Expand description
A PlaceholderDataBox allows you to reserve space in a JUMBF data structure
for content that will be filled in after the overall JUMBF data structure is
created.
You can specify a data size to reserve. When the initial JUMBF data
structure is created, the box will be zero-filled to the specified size.
Later, you can call replace_payload() to replace that reserved space
with new content.
Implementations§
Source§impl PlaceholderDataBox
impl PlaceholderDataBox
Sourcepub fn new(tbox: BoxType, size: usize) -> Self
pub fn new(tbox: BoxType, size: usize) -> Self
Create a new placeholder data box that will reserve size bytes.
The box will be given the JUMBF box type specified by tbox.
Sourcepub fn offset(&self) -> Option<u64>
pub fn offset(&self) -> Option<u64>
Return the offset in the stream where the payload can be written.
Will return None before the superbox’s write_jumbf() method is
called.
Sourcepub fn replace_payload(
&self,
to_stream: &mut dyn WriteAndSeek,
payload: &[u8],
) -> Result<()>
pub fn replace_payload( &self, to_stream: &mut dyn WriteAndSeek, payload: &[u8], ) -> Result<()>
Replace the zero-filled placeholder content with actual content.
An error will be returned if payload is larger than the placeholder
size specified when this PlaceholderDataBox was created.
Assuming the placeholder is not larger than the initial reservation,
this method will seek the stream to offset() and write the new
payload at that location.
Trait Implementations§
Source§impl ToBox for PlaceholderDataBox
impl ToBox for PlaceholderDataBox
Source§fn box_type(&self) -> BoxType
fn box_type(&self) -> BoxType
write_payload() method. Read moreSource§fn payload_size(&self) -> Result<usize>
fn payload_size(&self) -> Result<usize>
write_payload() method. Read more