JAVA?е???????????
???????????? ???????[ 2013/12/24 16:42:05 ] ????????JAVA ???????
?????????????????????????????Щ????
public class IOTest {
private static String str = "????";
public static void main(String[] args) throws Exception {
System.out.println(System.getProperty("file.encoding"));
testChar();
printBytes(str.getBytes("utf-8"));
printBytes(str.getBytes("unicode"));
printBytes(str.getBytes("gb2312"));
printBytes(str.getBytes("iso8859-1"));
printBytes("ABC".getBytes("iso8859-1"));
byte[] bytes = {-28?? -72?? -83?? -26?? -106?? -121};
System.out.println(getStringFromBytes(bytes??"utf-8"));
byte[] bytes1 = { -2??-1??78?? 45?? 101?? -121};
System.out.println(getStringFromBytes(bytes1??"unicode"));
System.out.println(new String(bytes1));
readBytesFromFile("C:/D/charset/utf8.txt");
readBytesFromFile("C:/D/charset/gb2312.txt");
readStringFromFile("C:/D/charset/utf8.txt"??"utf8");
readStringFromFile("C:/D/charset/gb2312.txt"??"gb2312");
}
public static void testChar() throws Exception {
char c = '??';
int i = c;
System.out.println(i);
System.out.println("u4E2D");
printBytes("??".getBytes("unicode"));
}
public static void printBytes(byte[] bytes ) {
for(int i=0; i<bytes.length;i++){
System.out.print(" " + bytes[i]);
}
System.out.println("");
}
public static String getStringFromBytes(byte[] bytes??String charset ) throws Exception {
return new String(bytes??charset);
}
public static void writeTofile(byte[] bytes ) {
for(int i=0; i<bytes.length;i++){
System.out.print(" " + bytes[i]);
}
System.out.println("");
}
public static void readBytesFromFile(String fileName ) throws Exception {
File f = new File(fileName);
FileInputStream fin = new FileInputStream(f);
byte[] readBytes = new byte[10];
while (true) {
if (fin.available() >= 10) {
fin.read(readBytes);
for (byte b : readBytes) {
System.out.print(b + " ");
}
} else {
byte[] lastbits = new byte[fin.available()];
fin.read(lastbits);
for (byte b : lastbits) {
System.out.print(b + " ");
}
break;
}
}
System.out.println("");
fin.close();
}
public static void readStringFromFile(String fileName??String charset) throws Exception {
File file = new File(fileName);
FileInputStream fis = new FileInputStream(file);
InputStreamReader fr = new InputStreamReader(fis??charset);
BufferedReader br = new BufferedReader(fr);
String line;
while ((line=br.readLine()) != null){
System.out.println(line);
}
br.close();
fr.close();
fis.close();
}
}
|
????Java???????????????Java?У?????????????????Unicode???д洢?????????????????
??????????????
char c = '??';
int i = c;
System.out.println(i); //20013
System.out.println("u4E2D"); //??
printBytes("??".getBytes("unicode")); //-2 -1 78 45
|
????20013?????16?????4E2D?? 4E2D?????10?????78 45??
???????????????????????漰???????????????????SPASVOС??(021-61079698-8054)?????????????????????????
??????
Java???????????Щ???????????????Java????????????????Java?б???Map????????Java Web???????????????Java??????????????д?????Java????????7???????????????????????(java .net ?????)???Java??????????Python??????Java webdriver??λ????????′????е?????Java??д??????????????????Java???????????????JavaScript????????????Java?????????????????? Java???????10??????????????Java?м????????????????java???????ü???????????м???????????????????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11????????
?????????App Bug???????????????????????Jmeter?????????QC??????APP????????????????app?????е????????jenkins+testng+ant+webdriver??????????????JMeter????HTTP???????Selenium 2.0 WebDriver ??????