Net Flex v版本的 MD5 值为:385c18cd288a0634841c2be4c516c1dd
以下内容为反编译后的 CompressionFactory.java 源代码,内容仅作参考
package com.trilead.ssh2.compression;
import java.util.Vector;
public class CompressionFactory {
static Vector<CompressorEntry> compressors;
public static class CompressorEntry {
String compressorClass;
String type;
public CompressorEntry(String str, String str2) {
this.type = str;
this.compressorClass = str2;
}
}
static {
Vector<CompressorEntry> vector = new Vector<>();
compressors = vector;
vector.addElement(new CompressorEntry("zlib", "com.trilead.ssh2.compression.Zlib"));
compressors.addElement(new CompressorEntry("zlib@openssh.com", "com.trilead.ssh2.compression.ZlibOpenSSH"));
compressors.addElement(new CompressorEntry("none", ""));
}
public static void checkCompressorList(String[] strArr) {
for (String str : strArr) {
getEntry(str);
}
}
public static ICompressor createCompressor(String str) {
try {
CompressorEntry entry = getEntry(str);
if ("".equals(entry.compressorClass)) {
return null;
}
return (ICompressor) Class.forName(entry.compressorClass).newInstance();
} catch (Exception unused) {
throw new IllegalArgumentException("Cannot instantiate " + str);
}
}
public static String[] getDefaultCompressorList() {
String[] strArr = new String[compressors.size()];
for (int i = 0; i < compressors.size(); i++) {
strArr[i] = new String(compressors.elementAt(i).type);
}
return strArr;
}
private static CompressorEntry getEntry(String str) {
for (int i = 0; i < compressors.size(); i++) {
CompressorEntry elementAt = compressors.elementAt(i);
if (elementAt.type.equals(str)) {
return elementAt;
}
}
throw new IllegalArgumentException("Unkown algorithm " + str);
}
}