pub struct HwpxReader { /* private fields */ }Expand description
HWPX ZIP 컨테이너 리더
Implementations§
Source§impl HwpxReader
impl HwpxReader
Sourcepub fn read_file(&mut self, path: &str) -> Result<String, HwpxError>
pub fn read_file(&mut self, path: &str) -> Result<String, HwpxError>
지정한 경로의 파일을 UTF-8 문자열로 읽는다.
엔트리 압축 해제 크기는 MAX_XML_SIZE로 제한된다.
[Issue #1932] UTF-8 이 부분 손상된 실문서(통계청 보도자료 계열 — header.xml 선두부 invalid byte)를 한글은 정상 열람하므로, 엄격 변환 실패 시 관용(lossy) 디코딩으로 폴백한다 (손상 바이트는 U+FFFD 치환, 경고 로그). 문서 전체를 버리는 종전 동작은 한글 대비 과잉 거부였다.
Sourcepub fn read_file_bytes(&mut self, path: &str) -> Result<Vec<u8>, HwpxError>
pub fn read_file_bytes(&mut self, path: &str) -> Result<Vec<u8>, HwpxError>
지정한 경로의 파일을 바이트 배열로 읽는다.
엔트리 압축 해제 크기는 MAX_BINDATA_SIZE로 제한된다.
Sourcepub fn read_file_bytes_limited(
&mut self,
path: &str,
max_bytes: usize,
) -> Result<Vec<u8>, HwpxError>
pub fn read_file_bytes_limited( &mut self, path: &str, max_bytes: usize, ) -> Result<Vec<u8>, HwpxError>
지정한 경로의 파일을 max_bytes 바이트까지만 압축 해제한다.
Sourcepub fn file_size_limited(
&mut self,
path: &str,
max_bytes: usize,
) -> Result<usize, HwpxError>
pub fn file_size_limited( &mut self, path: &str, max_bytes: usize, ) -> Result<usize, HwpxError>
ZIP central directory의 비압축 크기만 상한과 비교한다.
BinData 존재 여부·길이처럼 실제 바이트가 필요 없는 질의가 ZIP payload를
materialize하지 않도록 쓴다. 실제 읽기는 반드시
Self::read_file_bytes_limited를 다시 거치므로, 손상된 size 메타데이터를
신뢰해 상한을 우회하지 않는다.
Sourcepub fn raw_deflated_entry(&mut self, path: &str) -> Option<DeflatedZipEntry>
pub fn raw_deflated_entry(&mut self, path: &str) -> Option<DeflatedZipEntry>
deflate 로 저장된 엔트리의 압축 바이트와 CRC-32·비압축 크기 (압축 해제 없음).
deflate 가 아니거나 압축 크기가 MAX_BINDATA_SIZE 를 넘으면 None 이다.
Sourcepub fn file_names(&self) -> Vec<String>
pub fn file_names(&self) -> Vec<String>
아카이브 내 파일 목록을 반환한다.
Auto Trait Implementations§
impl !RefUnwindSafe for HwpxReader
impl !UnwindSafe for HwpxReader
impl Forget for HwpxReader
impl Freeze for HwpxReader
impl Move for HwpxReader
impl Send for HwpxReader
impl Sync for HwpxReader
impl Unpin for HwpxReader
impl UnsafeUnpin for HwpxReader
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<U, T> ToOwnedObj<U> for Twhere
U: FromObjRef<T>,
impl<U, T> ToOwnedObj<U> for Twhere
U: FromObjRef<T>,
Source§fn to_owned_obj(&self, data: FontData<'_>) -> U
fn to_owned_obj(&self, data: FontData<'_>) -> U
Convert this type into
T, using the provided data to resolve any offsets.