2 #include "zipios++/zipios-config.h"
5 #include "zipios++/meta-iostreams.h"
24 if ( ! entry->isValid() ) {
34 int position = _inbuf->pubseekoff(0, ios::cur,
36 if ( position != _data_start + static_cast< int >( _curr_entry.
getCompressedSize() ) )
50 istream is( _inbuf ) ;
51 is.exceptions(istream::eofbit | istream::failbit | istream::badbit);
53 if ( _curr_entry.isValid() ) {
54 _data_start = _inbuf->pubseekoff(0, ios::cur,
56 if ( _curr_entry.getMethod() == DEFLATED ) {
60 }
else if ( _curr_entry.getMethod() == STORED ) {
62 _remain = _curr_entry.getSize() ;
64 setg( &( _outvec[ 0 ] ),
65 &( _outvec[ 0 ] ) + _outvecsize,
66 &( _outvec[ 0 ] ) + _outvecsize ) ;
76 if ( _curr_entry.isValid() && _curr_entry.trailingDataDescriptor() )
77 throw FCollException(
"Trailing data descriptor in zip file not supported" ) ;
86 int ZipInputStreambuf::underflow() {
89 if ( _curr_entry.
getMethod() == DEFLATED )
90 return InflateInputStreambuf::underflow() ;
93 int num_b = min( _remain, _outvecsize ) ;
94 int g = _inbuf->sgetn( &(_outvec[ 0 ] ) , num_b ) ;
95 setg( &( _outvec[ 0 ] ),
97 &( _outvec[ 0 ] ) + g ) ;
100 return static_cast< unsigned char >( *gptr() ) ;