Updated Branches: refs/heads/master 562288bb6 -> c89436a8a
Remove unneeded test util class Project: http://git-wip-us.apache.org/repos/asf/mina-sshd/repo Commit: http://git-wip-us.apache.org/repos/asf/mina-sshd/commit/2e707b28 Tree: http://git-wip-us.apache.org/repos/asf/mina-sshd/tree/2e707b28 Diff: http://git-wip-us.apache.org/repos/asf/mina-sshd/diff/2e707b28 Branch: refs/heads/master Commit: 2e707b2817951cb276a71a000efa54d25c1cbbfa Parents: 562288b Author: Guillaume Nodet <[email protected]> Authored: Fri Jan 24 15:05:26 2014 +0100 Committer: Guillaume Nodet <[email protected]> Committed: Fri Jan 24 15:05:26 2014 +0100 ---------------------------------------------------------------------- .../java/org/apache/sshd/CompressionTest.java | 4 +- .../java/org/apache/sshd/util/Compression.java | 169 ------------------- 2 files changed, 2 insertions(+), 171 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/2e707b28/sshd-core/src/test/java/org/apache/sshd/CompressionTest.java ---------------------------------------------------------------------- diff --git a/sshd-core/src/test/java/org/apache/sshd/CompressionTest.java b/sshd-core/src/test/java/org/apache/sshd/CompressionTest.java index f98ed8c..d4c7b38 100644 --- a/sshd-core/src/test/java/org/apache/sshd/CompressionTest.java +++ b/sshd-core/src/test/java/org/apache/sshd/CompressionTest.java @@ -75,8 +75,8 @@ public class CompressionTest { sshd.start(); JSch.setConfig("compression.s2c", "[email protected],zlib,none"); JSch.setConfig("compression.c2s", "[email protected],zlib,none"); - JSch.setConfig("zlib", org.apache.sshd.util.Compression.class.getName()); - JSch.setConfig("[email protected]", org.apache.sshd.util.Compression.class.getName()); + JSch.setConfig("zlib", com.jcraft.jsch.jcraft.Compression.class.getName()); + JSch.setConfig("[email protected]", com.jcraft.jsch.jcraft.Compression.class.getName()); } @After http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/2e707b28/sshd-core/src/test/java/org/apache/sshd/util/Compression.java ---------------------------------------------------------------------- diff --git a/sshd-core/src/test/java/org/apache/sshd/util/Compression.java b/sshd-core/src/test/java/org/apache/sshd/util/Compression.java deleted file mode 100644 index 2b33433..0000000 --- a/sshd-core/src/test/java/org/apache/sshd/util/Compression.java +++ /dev/null @@ -1,169 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -/* -*-mode:java; c-basic-offset:2; indent-tabs-mode:nil -*- */ -/* -Copyright (c) 2002-2008 ymnk, JCraft,Inc. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in - the documentation and/or other materials provided with the distribution. - - 3. The names of the authors may not be used to endorse or promote products - derived from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, -INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND -FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JCRAFT, -INC. OR ANY CONTRIBUTORS TO THIS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, -INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, -OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, -EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -package org.apache.sshd.util; - -import com.jcraft.jzlib.JZlib; -import com.jcraft.jzlib.ZStream; - -/** - * TODO Add javadoc - * - * @author <a href="mailto:[email protected]">Apache MINA SSHD Project</a> - */ -public class Compression implements com.jcraft.jsch.Compression { - static private final int BUF_SIZE=4096; - - private int type; - private ZStream stream; - private byte[] tmpbuf=new byte[BUF_SIZE]; - - public Compression(){ - stream=new ZStream(); - } - - public void init(int type, int level){ - if(type==DEFLATER){ - stream.deflateInit(level); - this.type=DEFLATER; - } - else if(type==INFLATER){ - stream.inflateInit(); - inflated_buf=new byte[BUF_SIZE]; - this.type=INFLATER; - } - } - /* - static Compression getDeflater(int level){ - Compression foo=new Compression(); - foo.stream.deflateInit(level); - foo.type=DEFLATER; - return foo; - } - */ - private byte[] inflated_buf; - /* - static Compression getInflater(){ - Compression foo=new Compression(); - foo.stream.inflateInit(); - foo.inflated_buf=new byte[BUF_SIZE]; - foo.type=INFLATER; - return foo; - } - */ - - public int compress(byte[] buf, int start, int len){ - stream.next_in=buf; - stream.next_in_index=start; - stream.avail_in=len-start; - int status; - int outputlen=start; - - do{ - stream.next_out=tmpbuf; - stream.next_out_index=0; - stream.avail_out=BUF_SIZE; - status=stream.deflate(JZlib.Z_PARTIAL_FLUSH); - switch(status){ - case JZlib.Z_OK: - System.arraycopy(tmpbuf, 0, - buf, outputlen, - BUF_SIZE-stream.avail_out); - outputlen+=(BUF_SIZE-stream.avail_out); - break; - default: - System.err.println("compress: deflate returnd "+status); - } - } - while(stream.avail_out==0); - return outputlen; - } - - public byte[] uncompress(byte[] buffer, int start, int[] length){ - int inflated_end=0; - - stream.next_in=buffer; - stream.next_in_index=start; - stream.avail_in=length[0]; - - while(true){ - stream.next_out=tmpbuf; - stream.next_out_index=0; - stream.avail_out=BUF_SIZE; - int status=stream.inflate(JZlib.Z_PARTIAL_FLUSH); - switch(status){ - case JZlib.Z_OK: - if(inflated_buf.length<inflated_end+BUF_SIZE-stream.avail_out){ - byte[] foo=new byte[inflated_end+BUF_SIZE-stream.avail_out]; - System.arraycopy(inflated_buf, 0, foo, 0, inflated_end); - inflated_buf=foo; - } - System.arraycopy(tmpbuf, 0, - inflated_buf, inflated_end, - BUF_SIZE-stream.avail_out); - inflated_end+=(BUF_SIZE-stream.avail_out); - length[0]=inflated_end; - break; - case JZlib.Z_BUF_ERROR: - if(inflated_end>buffer.length-start){ - byte[] foo=new byte[inflated_end+start]; - System.arraycopy(buffer, 0, foo, 0, start); - System.arraycopy(inflated_buf, 0, foo, start, inflated_end); - buffer=foo; - } - else{ - System.arraycopy(inflated_buf, 0, buffer, start, inflated_end); - } - length[0]=inflated_end; - return buffer; - default: - System.err.println("uncompress: inflate returnd "+status); - return null; - } - } - } -}
