Replace deprecated Z(Input|Output)Stream

Thanks to Волков Вячеслав (Vyacheslav Volkov) for the hint.
This commit is contained in:
Florian Schmaus 2014-05-15 16:44:34 +02:00
parent 4c76f2652d
commit c80a4044e6
1 changed files with 5 additions and 8 deletions

View File

@ -23,9 +23,8 @@ import java.io.OutputStream;
import org.jivesoftware.smack.SmackConfiguration; import org.jivesoftware.smack.SmackConfiguration;
import org.jivesoftware.smack.compression.XMPPInputOutputStream; import org.jivesoftware.smack.compression.XMPPInputOutputStream;
import com.jcraft.jzlib.JZlib; import com.jcraft.jzlib.DeflaterOutputStream;
import com.jcraft.jzlib.ZInputStream; import com.jcraft.jzlib.InflaterInputStream;
import com.jcraft.jzlib.ZOutputStream;
/** /**
* This class provides XMPP "zlib" compression with the help of JZLib. * This class provides XMPP "zlib" compression with the help of JZLib.
@ -34,7 +33,6 @@ import com.jcraft.jzlib.ZOutputStream;
* @see <a href="http://www.jcraft.com/jzlib/">JZLib</a> * @see <a href="http://www.jcraft.com/jzlib/">JZLib</a>
* *
*/ */
@SuppressWarnings("deprecation")
public class JzlibInputOutputStream extends XMPPInputOutputStream { public class JzlibInputOutputStream extends XMPPInputOutputStream {
static { static {
@ -52,16 +50,15 @@ public class JzlibInputOutputStream extends XMPPInputOutputStream {
@Override @Override
public InputStream getInputStream(InputStream inputStream) throws IOException { public InputStream getInputStream(InputStream inputStream) throws IOException {
ZInputStream is = new ZInputStream(inputStream); final InflaterInputStream is = new InflaterInputStream(inputStream);
is.setFlushMode(JZlib.Z_SYNC_FLUSH);
return is; return is;
} }
@Override @Override
public OutputStream getOutputStream(OutputStream outputStream) throws IOException { public OutputStream getOutputStream(OutputStream outputStream) throws IOException {
ZOutputStream os = new ZOutputStream(outputStream); final DeflaterOutputStream os = new DeflaterOutputStream(outputStream);
os.setFlushMode(JZlib.Z_SYNC_FLUSH); os.setSyncFlush(true);
return os; return os;
} }