pub struct Archive<R> { /* private fields */ }Expand description
Reader for BinHex archives
Implementations§
Source§impl<R> Archive<R>
impl<R> Archive<R>
Sourcepub fn creator_code(&self) -> FourCC
pub fn creator_code(&self) -> FourCC
The file’s four-byte creator code
Sourcepub fn finder_flags(&self) -> FinderFlags
pub fn finder_flags(&self) -> FinderFlags
Finder flags at the time of compression
Sourcepub fn resource_len(&self) -> usize
pub fn resource_len(&self) -> usize
Number of bytes in the uncompressed resource fork
Sourcepub fn header_checksum(&self) -> u16
pub fn header_checksum(&self) -> u16
CRC-16 checksum of the header bytes
The CRC-16 configuration is CRC-16-XMODEM the CRC of ASCII “123456789” is 0x31C3.
Source§impl<R: Read + Seek> Archive<R>
impl<R: Read + Seek> Archive<R>
Sourcepub const HEADER: &[u8; 45] = b"(This file must be converted with BinHex 4.0)"
pub const HEADER: &[u8; 45] = b"(This file must be converted with BinHex 4.0)"
Fixed header that introduces the start of encoded data
Sourcepub fn try_from(inner: R) -> Result<Self, Error>
pub fn try_from(inner: R) -> Result<Self, Error>
Try to read an archive from the reader.
It searches for the start marker and reads the archive header after that. Returns an error if either fails.
Sourcepub fn data_fork(
&mut self,
) -> Result<ForkReader<&mut SixBitRleReader<R>>, Error>
pub fn data_fork( &mut self, ) -> Result<ForkReader<&mut SixBitRleReader<R>>, Error>
Open the data fork for reading
Since reading backwards through RLE encoded data is expensive, this should be called before accessing the resource fork, if the application wants to read both
Sourcepub fn resource_fork(
&mut self,
) -> Result<ForkReader<&mut SixBitRleReader<R>>, Error>
pub fn resource_fork( &mut self, ) -> Result<ForkReader<&mut SixBitRleReader<R>>, Error>
Open the resource fork for reading
Since reading backwards through RLE encoded data is expensive, this should be called after accessing the data fork, if the application wants to read both
Sourcepub fn verify(&mut self) -> Result<(), VerificationError>
pub fn verify(&mut self) -> Result<(), VerificationError>
Verify checksums of the whole archive, this resets the stream and reads the whole file to calculate the checksums.
Sourcepub fn into_inner(self) -> R
pub fn into_inner(self) -> R
Returns the underlying reader that was used initially to open the archive Note that the read position has probably changed