Page Speed Optimization Libraries  1.13.35.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Types | Public Member Functions | Static Public Member Functions | Friends | List of all members
net_instaweb::GzipInflater Class Reference

Public Types

enum  InflateType { kGzip, kDeflate }
 

Public Member Functions

 GzipInflater (InflateType type)
 
bool Init ()
 Should be called once, before inflating any data.
 
void ShutDown ()
 Should be called once, after inflating is finished.
 
bool HasUnconsumedInput () const
 
bool SetInput (const void *in, size_t in_size)
 
int InflateBytes (char *buf, size_t buf_size)
 
bool finished () const
 Has the entire input been inflated?
 
bool error () const
 Was an error encountered during inflating?
 

Static Public Member Functions

static bool Deflate (StringPiece in, InflateType format, Writer *writer)
 
static bool Deflate (StringPiece in, InflateType format, int compression_level, Writer *writer)
 
static bool Inflate (StringPiece in, InflateType format, Writer *writer)
 
static bool HasGzipMagicBytes (StringPiece in)
 Checks whether in starts with the gzip file signature.
 

Friends

class GzipInflaterTestPeer
 

Member Function Documentation

static bool net_instaweb::GzipInflater::Deflate ( StringPiece  in,
InflateType  format,
Writer writer 
)
static

Deflates a stringpiece, writing output to Writer. Returns false if there was some kind of failure, though none are expected.

bool net_instaweb::GzipInflater::HasUnconsumedInput ( ) const

Does the inflater still have input that has not yet been consumed? If true, the caller should call InflateBytes(). If false, the gzip inflater is ready for additional input.

static bool net_instaweb::GzipInflater::Inflate ( StringPiece  in,
InflateType  format,
Writer writer 
)
static

Inflates a stringpiece, writing output to Writer. Returns false if there was some kind of failure, such as a corrupt input.

int net_instaweb::GzipInflater::InflateBytes ( char *  buf,
size_t  buf_size 
)

Decompress the input passed in via SetInput. Should be called until HasUnconsumedInput returns false. Returns the number of bytes inflated, or -1 if an error was encountered while inflating.

bool net_instaweb::GzipInflater::SetInput ( const void *  in,
size_t  in_size 
)

Pass a gzip-compressed buffer to the gzip inflater. The gzip inflater will inflate the buffer via InflateBytes(). SetInput should not be called if HasUnconsumedInput() is true, and the buffer passed into SetInput should not be modified by the caller until HasUnconsumedInput() returns false.


The documentation for this class was generated from the following file: