From c80a4044e6e5bc2777a8b26e50b5b0d25a78fb24 Mon Sep 17 00:00:00 2001 From: Florian Schmaus Date: Thu, 15 May 2014 16:44:34 +0200 Subject: [PATCH] Replace deprecated Z(Input|Output)Stream MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Thanks to Волков Вячеслав (Vyacheslav Volkov) for the hint. --- .../compression/jzlib/JzlibInputOutputStream.java | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/smack-compression-jzlib/src/main/java/org/jivesoftware/smack/compression/jzlib/JzlibInputOutputStream.java b/smack-compression-jzlib/src/main/java/org/jivesoftware/smack/compression/jzlib/JzlibInputOutputStream.java index 6dfc6568f..356eef8a0 100644 --- a/smack-compression-jzlib/src/main/java/org/jivesoftware/smack/compression/jzlib/JzlibInputOutputStream.java +++ b/smack-compression-jzlib/src/main/java/org/jivesoftware/smack/compression/jzlib/JzlibInputOutputStream.java @@ -23,9 +23,8 @@ import java.io.OutputStream; import org.jivesoftware.smack.SmackConfiguration; import org.jivesoftware.smack.compression.XMPPInputOutputStream; -import com.jcraft.jzlib.JZlib; -import com.jcraft.jzlib.ZInputStream; -import com.jcraft.jzlib.ZOutputStream; +import com.jcraft.jzlib.DeflaterOutputStream; +import com.jcraft.jzlib.InflaterInputStream; /** * This class provides XMPP "zlib" compression with the help of JZLib. @@ -34,7 +33,6 @@ import com.jcraft.jzlib.ZOutputStream; * @see JZLib * */ -@SuppressWarnings("deprecation") public class JzlibInputOutputStream extends XMPPInputOutputStream { static { @@ -52,16 +50,15 @@ public class JzlibInputOutputStream extends XMPPInputOutputStream { @Override public InputStream getInputStream(InputStream inputStream) throws IOException { - ZInputStream is = new ZInputStream(inputStream); - is.setFlushMode(JZlib.Z_SYNC_FLUSH); + final InflaterInputStream is = new InflaterInputStream(inputStream); return is; } @Override public OutputStream getOutputStream(OutputStream outputStream) throws IOException { - ZOutputStream os = new ZOutputStream(outputStream); - os.setFlushMode(JZlib.Z_SYNC_FLUSH); + final DeflaterOutputStream os = new DeflaterOutputStream(outputStream); + os.setSyncFlush(true); return os; }