Class CompressionZlib
- java.lang.Object
-
- org.apache.sshd.common.compression.BaseCompression
-
- org.apache.sshd.common.compression.CompressionZlib
-
- All Implemented Interfaces:
Compression
,CompressionInformation
,NamedResource
- Direct Known Subclasses:
CompressionDelayedZlib
public class CompressionZlib extends BaseCompression
ZLib based Compression.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.apache.sshd.common.compression.Compression
Compression.Type
-
-
Field Summary
Fields Modifier and Type Field Description private static int
BUF_SIZE
private java.util.zip.Deflater
compresser
private java.util.zip.Inflater
decompresser
private byte[]
tmpbuf
-
Fields inherited from interface org.apache.sshd.common.NamedResource
BY_NAME_COMPARATOR, NAME_EXTRACTOR
-
-
Constructor Summary
Constructors Modifier Constructor Description CompressionZlib()
Create a new instance of a ZLib base compressionprotected
CompressionZlib(java.lang.String name)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
compress(Buffer buffer)
Compress the given buffer in place.void
init(Compression.Type type, int level)
Initialize this object to either compress or uncompress data.boolean
isDelayed()
Delayed compression is an Open-SSH specific feature which informs both the client and server to not compress data before the session has been authenticated.void
uncompress(Buffer from, Buffer to)
Uncompress the data in a buffer into another buffer.-
Methods inherited from class org.apache.sshd.common.compression.BaseCompression
getName, isCompressionExecuted, toString
-
-
-
-
Field Detail
-
BUF_SIZE
private static final int BUF_SIZE
- See Also:
- Constant Field Values
-
tmpbuf
private byte[] tmpbuf
-
compresser
private java.util.zip.Deflater compresser
-
decompresser
private java.util.zip.Inflater decompresser
-
-
Method Detail
-
isDelayed
public boolean isDelayed()
Description copied from interface:CompressionInformation
Delayed compression is an Open-SSH specific feature which informs both the client and server to not compress data before the session has been authenticated.- Returns:
- if the compression is delayed after authentication or not
-
init
public void init(Compression.Type type, int level)
Description copied from interface:Compression
Initialize this object to either compress or uncompress data. This method must be called prior to any calls to eithercompress
oruncompress
. Once the object has been initialized, only one ofcompress
oruncompress
methods can be called.- Parameters:
type
- compression typelevel
- compression level
-
compress
public void compress(Buffer buffer) throws java.io.IOException
Description copied from interface:Compression
Compress the given buffer in place.- Parameters:
buffer
- the buffer containing the data to compress- Throws:
java.io.IOException
- if an error occurs
-
uncompress
public void uncompress(Buffer from, Buffer to) throws java.io.IOException
Description copied from interface:Compression
Uncompress the data in a buffer into another buffer.- Parameters:
from
- the buffer containing the data to uncompressto
- the buffer receiving the uncompressed data- Throws:
java.io.IOException
- if an error occurs
-
-