📄 opstring.java
字号:
// Decompiled by Jad v1.5.8e2. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://kpdus.tripod.com/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi space
// Source File Name: OpString.java
package carven;
import java.io.PrintStream;
import sun.io.ByteToCharConverter;
import sun.io.CharToByteConverter;
public class OpString
{
public OpString()
{
}
public static String Convert(String source, String oldCharset, String newCharset)
throws Exception
{
byte tmp[] = source.getBytes(oldCharset);
return new String(tmp, newCharset);
}
public static String FillEmpty(String src, int len)
{
char charSrc[] = src.toCharArray();
char result[] = new char[len];
for (int i = 0; i < charSrc.length; i++)
result[i] = charSrc[i];
return new String(result);
}
public static String ContactString(String rtnString, String addString, String sep)
{
if (rtnString == null)
rtnString = "";
if (rtnString.equals(""))
rtnString = addString;
else
rtnString = rtnString + sep + addString;
return rtnString;
}
public static String replaceAll(String sourceString, String oldString, String newString)
{
do
{
int pos0 = sourceString.indexOf(oldString);
if (pos0 == -1)
return sourceString;
String str1 = sourceString.substring(0, pos0);
String str2 = sourceString.substring(pos0 + oldString.length());
sourceString = str1 + newString + str2;
} while (true);
}
public static String replaceFirst(String sourceString, String oldString, String newString)
{
int pos0 = sourceString.indexOf(oldString);
if (pos0 == -1)
{
return sourceString;
} else
{
String str1 = sourceString.substring(0, pos0);
String str2 = sourceString.substring(pos0 + oldString.length());
sourceString = str1 + newString + str2;
return sourceString;
}
}
public static String UnicodeByteToGBString(byte codedData[])
throws Exception
{
byte tmpbyteun[] = codedData;
char tmpchargb[] = new char[tmpbyteun.length / 2];
for (int z = 0; z < tmpbyteun.length - 1; z += 2)
tmpchargb[z / 2] = (char)(tmpbyteun[z] * 256 + ((char)tmpbyteun[z + 1] & 0xff));
CharToByteConverter converter = CharToByteConverter.getConverter("gb2312");
tmpbyteun = converter.convertAll(tmpchargb);
return new String(tmpbyteun, "gb2312");
}
public static byte[] GBString2UnicodeByte(String content)
throws Exception
{
ByteToCharConverter converter = ByteToCharConverter.getConverter("GB2312");
byte tmpbytegb[] = content.getBytes("unicode");
char tmpcharun[] = converter.convertAll(tmpbytegb);
byte tmpbyteun[] = new byte[tmpcharun.length * 2];
for (int x = 0; x < tmpcharun.length; x++)
{
tmpbyteun[x * 2] = (byte)(tmpcharun[x] >>> 8);
tmpbyteun[x * 2 + 1] = (byte)(tmpcharun[x] & 0xff);
}
return tmpbyteun;
}
public static byte[] GBString2ISO8859(String content)
throws Exception
{
ByteToCharConverter converter = ByteToCharConverter.getConverter("GB2312");
byte tmpbytegb[] = content.getBytes("ISO-8859-1");
char tmpcharun[] = converter.convertAll(tmpbytegb);
byte tmpbyteun[] = new byte[tmpcharun.length * 2];
for (int x = 0; x < tmpcharun.length; x++)
{
tmpbyteun[x * 2] = (byte)(tmpcharun[x] >>> 8);
tmpbyteun[x * 2 + 1] = (byte)(tmpcharun[x] & 0xff);
}
return tmpbyteun;
}
public static String SqlReplace(String content)
{
if (content == null)
{
return "";
} else
{
content = content.replaceAll("'", "''");
return content;
}
}
public static void main(String args[])
{
try
{
byte b[] = {
72, 0, 64, 0, 64, 8, 1, 1, 65, 73,
0, 9, 1, 72, -52, 72, 8, 73, 0, 73,
0, 73, 0, 73, 0, 73, -53, 72, -12, 9,
1, 72, -52, 72, 8, 72, 73, 73, 73, 73,
73, 73, 73, 1, 1, 73, 83, 72, 1, 72,
72, 1, 65, 9, 1, 72, -12, 1, 1, 1,
1, 1, 1, 1, 65, -41, -48, 1, 9, 9,
9, 72, 9, 72, 72, 1, 65, 9, 1, 64,
73, 65, -34, 65, -34, 65, -34, -126, -72, 1,
64, 72, -12, 9, 1, 72, -52, 72, 73, 72,
-12, 9, 9, 1, 65, 72, 72, 8, 72, 8,
72, 8, 72, 72, 0, 1, -41, 72, 1, 9,
9, 72, 0, 72, 72, 72, -12, 9, 1, 72,
1, 72, 73, 1, 65, 9, 9, 1, -38
};
System.out.println(new String(b, "gbk"));
byte tmpbyteun[] = b;
char tmpchargb[] = new char[tmpbyteun.length / 2];
for (int z = 0; z < tmpbyteun.length - 1; z += 2)
tmpchargb[z / 2] = (char)(tmpbyteun[z] * 256 + ((char)tmpbyteun[z + 1] & 0xff));
CharToByteConverter converter = CharToByteConverter.getConverter("gb2312");
tmpbyteun = converter.convertAll(tmpchargb);
System.out.println(new String(tmpbyteun, "gb2312"));
}
catch (Exception ee)
{
ee.printStackTrace();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -