#[non_exhaustive]pub enum ObjStmError {
NotAStream,
WrongType,
BadObjectCount,
BadFirst,
TooManyObjects(usize),
BadPairTable,
DataOutOfRange,
IndexOutOfRange {
index: usize,
count: usize,
},
OffsetOutOfRange,
Decode(FilterError),
Parse(ParseError),
SoleReference,
}Expand description
Something went wrong reading an object stream (§7.5.7).
C-GOOD-ERR via thiserror; every variant is Send + Sync + 'static. Variants name the specific spec rule violated so a
diagnostic can point at the producer’s actual mistake.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
NotAStream
The object a type-2 entry named as its container is not a stream object at all (§7.5.7: an object stream is a stream).
WrongType
The container’s /Type is present but is not /ObjStm
(Table 16, Required).
BadObjectCount
/N (Table 16, Required) is missing or not a direct
non-negative integer.
Table 16 does not mark /N direct-only, but resolving an
indirect /N would require a document-level resolve inside
the loader that is building the document — pdfcer refuses rather
than reordering the load for a case no real producer emits.
BadFirst
/First (Table 16, Required) is missing, not a direct
non-negative integer, or points past the end of the decoded
data.
TooManyObjects(usize)
/N exceeded MAX_OBJSTM_OBJECTS (pdfcer guard).
BadPairTable
The N objnum offset integer pairs could not be read from the
region before /First — too few numbers, a non-integer token, a
negative value, or a pair extending past /First.
DataOutOfRange
The container’s raw data span did not lie inside the retained buffer (a loader-side coordinate bug, surfaced rather than panicked).
IndexOutOfRange
A type-2 entry’s index is past the last pair in the table.
Fields
OffsetOutOfRange
First + offset for the requested object falls outside the
decoded data.
Decode(FilterError)
The container’s /Filter chain failed to decode.
Parse(ParseError)
The bytes at the object’s position are not a well-formed COS object.
SoleReference
The stored object consists solely of an indirect reference —
§7.5.7 states an object in an object stream “shall not consist
solely of an object reference” (its EXAMPLE 2 of the forbidden
form is 3 0 R). The prohibition exists to prevent an aliasing
ambiguity; the spec does not define reader behaviour, so pdfcer
treats it as malformed.
Trait Implementations§
Source§impl Clone for ObjStmError
impl Clone for ObjStmError
Source§impl Debug for ObjStmError
impl Debug for ObjStmError
Source§impl Display for ObjStmError
impl Display for ObjStmError
Source§impl Error for ObjStmError
impl Error for ObjStmError
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()