本文整理匯總了C#中Org.BouncyCastle.Utilities.Zlib.ZStream類的典型用法代碼示例。如果您正苦於以下問題:C# ZStream類的具體用法?C# ZStream怎麽用?C# ZStream使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
ZStream類屬於Org.BouncyCastle.Utilities.Zlib命名空間,在下文中一共展示了ZStream類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: DeflateOutputStream
public DeflateOutputStream(Stream output, ZStream z, bool compress)
: base(output)
{
this.z = z;
this.compress = compress;
this.FlushMode = JZlib.Z_PARTIAL_FLUSH;
}
示例2: TlsDeflateCompression
public TlsDeflateCompression(int level)
{
this.zIn = new ZStream();
this.zIn.inflateInit();
this.zOut = new ZStream();
this.zOut.deflateInit(level);
}
示例3: DeflateOutputStream
public DeflateOutputStream(Stream output, ZStream z, bool compress)
: base(output)
{
this.z = z;
this.compress = compress;
// TODO http://www.bolet.org/~pornin/deflate-flush.html says we should use Z_SYNC_FLUSH
this.FlushMode = JZlib.Z_PARTIAL_FLUSH;
}
示例4: TlsDeflateCompression
public TlsDeflateCompression()
{
this.zIn = new ZStream();
this.zIn.inflateInit();
this.zOut = new ZStream();
// TODO Allow custom setting
this.zOut.deflateInit(JZlib.Z_DEFAULT_COMPRESSION);
}
示例5: DeflateOutputStream
public DeflateOutputStream(Stream output, ZStream z, bool compress)
: base(output, z)
{
this.compress = compress;
/*
* See discussion at http://www.bolet.org/~pornin/deflate-flush.html .
*/
this.FlushMode = JZlib.Z_SYNC_FLUSH;
}
示例6: CompressedStream
public CompressedStream (Stream baseStream)
{
BaseStream = baseStream;
zOut = new ZStream ();
zOut.deflateInit (5, true);
zOut.next_out = new byte[4096];
zIn = new ZStream ();
zIn.inflateInit (true);
zIn.next_in = new byte[4096];
}
示例7: ZOutputStream
public ZOutputStream(Stream output, ZStream z)
: base()
{
Debug.Assert(output.CanWrite);
if (z == null)
{
z = new ZStream();
z.inflateInit();
}
this.output = output;
this.z = z;
this.compress = false;
}
示例8: ZOutputStream
public ZOutputStream(Stream output, ZStream z)
: base()
{
Debug.Assert(output.CanWrite);
if (z == null)
{
z = new ZStream();
}
if (z.istate == null && z.dstate == null)
{
z.inflateInit();
}
this.output = output;
this.compress = (z.istate == null);
this.z = z;
}
示例9: ZInputStream
public ZInputStream(Stream input, ZStream z)
: base()
{
Debug.Assert(input.CanRead);
if (z == null)
{
z = new ZStream();
}
if (z.istate == null && z.dstate == null)
{
z.inflateInit();
}
this.input = input;
this.compress = (z.istate == null);
this.z = z;
this.z.next_in = buf;
this.z.next_in_index = 0;
this.z.avail_in = 0;
}
示例10: free
internal void free(ZStream z){
reset(z, null);
window=null;
hufts=null;
//ZFREE(z, s);
}
示例11: reset
internal void reset(ZStream z, long[] c){
if(c!=null) c[0]=check;
if(mode==BTREE || mode==DTREE){
}
if(mode==CODES){
codes.free(z);
}
mode=TYPE;
bitk=0;
bitb=0;
read=write=0;
if(checkfn != null)
z.adler=check=z._adler.adler32(0L, null, 0, 0);
}
示例12: inflateSync
internal int inflateSync(ZStream z)
{
int n; // number of bytes to look at
int p; // pointer to bytes
int m; // number of marker bytes found in a row
long r, w; // temporaries to save total_in and total_out
// set up
if(z == null || z.istate == null)
return Z_STREAM_ERROR;
if(z.istate.mode != BAD){
z.istate.mode = BAD;
z.istate.marker = 0;
}
if((n=z.avail_in)==0)
return Z_BUF_ERROR;
p=z.next_in_index;
m=z.istate.marker;
// search
while (n!=0 && m < 4){
if(z.next_in[p] == mark[m]){
m++;
}
else if(z.next_in[p]!=0){
m = 0;
}
else{
m = 4 - m;
}
p++; n--;
}
// restore
z.total_in += p-z.next_in_index;
z.next_in_index = p;
z.avail_in = n;
z.istate.marker = m;
// return no joy or set up to restart on a new block
if(m != 4){
return Z_DATA_ERROR;
}
r=z.total_in; w=z.total_out;
inflateReset(z);
z.total_in=r; z.total_out = w;
z.istate.mode = BLOCKS;
return Z_OK;
}
示例13: deflateSetDictionary
internal int deflateSetDictionary (ZStream strm, byte[] dictionary, int dictLength){
int length = dictLength;
int index=0;
if(dictionary == null || status != INIT_STATE)
return Z_STREAM_ERROR;
strm.adler=strm._adler.adler32(strm.adler, dictionary, 0, dictLength);
if(length < MIN_MATCH) return Z_OK;
if(length > w_size-MIN_LOOKAHEAD){
length = w_size-MIN_LOOKAHEAD;
index=dictLength-length; // use the tail of the dictionary
}
System.Array.Copy(dictionary, index, window, 0, length);
strstart = length;
block_start = length;
// Insert all strings in the hash table (except for the last two bytes).
// s->lookahead stays null, so s->ins_h will be recomputed at the next
// call of fill_window.
ins_h = window[0]&0xff;
ins_h=(((ins_h)<<hash_shift)^(window[1]&0xff))&hash_mask;
for(int n=0; n<=length-MIN_MATCH; n++){
ins_h=(((ins_h)<<hash_shift)^(window[(n)+(MIN_MATCH-1)]&0xff))&hash_mask;
prev[n&w_mask]=head[ins_h];
head[ins_h]=(short)n;
}
return Z_OK;
}
示例14: inflateReset
internal int inflateReset(ZStream z)
{
if(z == null || z.istate == null) return Z_STREAM_ERROR;
z.total_in = z.total_out = 0;
z.msg = null;
z.istate.mode = z.istate.nowrap!=0 ? BLOCKS : METHOD;
z.istate.blocks.reset(z, null);
return Z_OK;
}
示例15: inflateSetDictionary
internal int inflateSetDictionary(ZStream z, byte[] dictionary, int dictLength)
{
int index=0;
int length = dictLength;
if(z==null || z.istate == null|| z.istate.mode != DICT0)
return Z_STREAM_ERROR;
if(z._adler.adler32(1L, dictionary, 0, dictLength)!=z.adler){
return Z_DATA_ERROR;
}
z.adler = z._adler.adler32(0, null, 0, 0);
if(length >= (1<<z.istate.wbits)){
length = (1<<z.istate.wbits)-1;
index=dictLength - length;
}
z.istate.blocks.set_dictionary(dictionary, index, length);
z.istate.mode = BLOCKS;
return Z_OK;
}