change charactor encoding to UTF-8
parent
10811b3f41
commit
3fadb8ad41
|
@ -14,14 +14,14 @@ run the FastDFS Java Client test:
|
|||
java -cp <fastdfs_client_jar_filename> org.csource.fastdfs.test.TestClient <config_filename> <upload_filename>
|
||||
|
||||
eg.:
|
||||
java -cp fastdfs_client_v1.22.jar org.csource.fastdfs.test.TestClient fdfs_client.conf c:\windows\system32\notepad.exe
|
||||
java -cp fastdfs_client_v1.25.jar org.csource.fastdfs.test.TestClient fdfs_client.conf c:\windows\system32\notepad.exe
|
||||
|
||||
or:
|
||||
java -cp fastdfs_client_v1.22.jar org.csource.fastdfs.test.TestClient fdfs_client.conf /usr/include/stdlib.h
|
||||
java -cp fastdfs_client_v1.25.jar org.csource.fastdfs.test.TestClient fdfs_client.conf /usr/include/stdlib.h
|
||||
|
||||
|
||||
run the FastDFS monitor:
|
||||
java -cp <fastdfs_client_jar_filename> org.csource.fastdfs.test.Monitor <config_filename>
|
||||
|
||||
eg.:
|
||||
java -cp fastdfs_client_v1.22.jar org.csource.fastdfs.test.Monitor fdfs_client.conf
|
||||
java -cp fastdfs_client_v1.25.jar org.csource.fastdfs.test.Monitor fdfs_client.conf
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
destdir="${fastdfs_client.bin_dir}"
|
||||
includes="org/**/*.java"
|
||||
debug="on"
|
||||
encoding="ISO8859-1"
|
||||
encoding="UTF-8"
|
||||
failonerror="true"/>
|
||||
</target>
|
||||
|
||||
|
@ -52,4 +52,4 @@
|
|||
<target name="core" depends="compile"/>
|
||||
|
||||
</project>
|
||||
|
||||
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
connect_timeout = 2
|
||||
network_timeout = 30
|
||||
charset = ISO8859-1
|
||||
charset = UTF-8
|
||||
http.tracker_http_port = 8080
|
||||
http.anti_steal_token = no
|
||||
http.secret_key = FastDFS1234567890
|
||||
|
||||
tracker_server = 192.168.0.116:22122
|
||||
tracker_server = 192.168.0.119:22122
|
||||
tracker_server = 10.0.11.243:22122
|
||||
tracker_server = 10.0.11.244:22122
|
||||
|
|
|
@ -461,7 +461,7 @@ public class Base64
|
|||
try
|
||||
{
|
||||
Base64 b64 = new Base64();
|
||||
String str = "agfrtu喀et什1234假大erty空234发喀2344什的";
|
||||
String str = "agfrtu¿¦etʲ1234¼Ù´óerty¿Õ234·¢¿¦2344ʲµÄ";
|
||||
String str64 = "";
|
||||
|
||||
//encode
|
||||
|
|
|
@ -127,91 +127,56 @@ public class IniFileReader
|
|||
}
|
||||
|
||||
private void loadFromFile(String conf_filename) throws FileNotFoundException, IOException
|
||||
{
|
||||
//修改人 孟鹏飞,问题说明 使用中发现原来客户端打jar包后,在另一个项目中引用,另一个项目打jar包后运行时找不到客户端配置文件 ,能不能把我名字加上,以后好找工作
|
||||
// FileReader fReader;
|
||||
// BufferedReader buffReader;
|
||||
// String line;
|
||||
// String[] parts;
|
||||
String name;
|
||||
String value;
|
||||
Object obj;
|
||||
ArrayList valueList;
|
||||
InputStream is=null;
|
||||
// fReader = new FileReader(conf_filename);
|
||||
// buffReader = new BufferedReader(fReader);
|
||||
this.paramTable = new Hashtable();
|
||||
|
||||
try
|
||||
{
|
||||
// while ((line=buffReader.readLine()) != null)
|
||||
// {
|
||||
// line = line.trim();
|
||||
// if (line.length() == 0 || line.charAt(0) == '#')
|
||||
// {
|
||||
// continue;
|
||||
// }
|
||||
//
|
||||
// parts = line.split("=", 2);
|
||||
// if (parts.length != 2)
|
||||
// {
|
||||
// continue;
|
||||
// }
|
||||
is = Thread.currentThread().getContextClassLoader().getResourceAsStream(conf_filename);
|
||||
// System.out.println(conf_filename+"========================================");
|
||||
Properties props = new Properties();
|
||||
props.load(is);
|
||||
Iterator<Map.Entry<Object, Object>> it = props.entrySet().iterator();
|
||||
while (it.hasNext()) {
|
||||
Map.Entry<Object, Object> entry = it.next();
|
||||
name= entry.getKey().toString();
|
||||
value = entry.getValue().toString();
|
||||
// System.out.println(name+"======================================");
|
||||
obj = this.paramTable.get(name);
|
||||
if (obj == null)
|
||||
{
|
||||
this.paramTable.put(name, value);
|
||||
}
|
||||
else if (obj instanceof String)
|
||||
{
|
||||
valueList = new ArrayList();
|
||||
valueList.add(obj);
|
||||
valueList.add(value);
|
||||
this.paramTable.put(name, valueList);
|
||||
}
|
||||
else
|
||||
{
|
||||
valueList = (ArrayList)obj;
|
||||
valueList.add(value);
|
||||
}
|
||||
}
|
||||
// name = parts[0].trim();
|
||||
// value = parts[1].trim();
|
||||
|
||||
// obj = this.paramTable.get(name);
|
||||
// if (obj == null)
|
||||
// {
|
||||
// this.paramTable.put(name, value);
|
||||
// }
|
||||
// else if (obj instanceof String)
|
||||
// {
|
||||
// valueList = new ArrayList();
|
||||
// valueList.add(obj);
|
||||
// valueList.add(value);
|
||||
// this.paramTable.put(name, valueList);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// valueList = (ArrayList)obj;
|
||||
// valueList.add(value);
|
||||
// }
|
||||
// }
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (is!=null)
|
||||
is.close();
|
||||
// fReader.close();
|
||||
}
|
||||
}
|
||||
{
|
||||
//修改人 孟鹏飞,问题说明 使用中发现原来客户端打jar包后,在另一个项目中引用,另一个项目打jar包后运行时找不到客户端配置文件 ,能不能把我名字加上,以后好找工作
|
||||
String name;
|
||||
String value;
|
||||
Object obj;
|
||||
ArrayList valueList;
|
||||
InputStream is=null;
|
||||
this.paramTable = new Hashtable();
|
||||
|
||||
try
|
||||
{
|
||||
Properties props;
|
||||
try {
|
||||
is = Thread.currentThread().getContextClassLoader().getResourceAsStream(conf_filename);
|
||||
props = new Properties();
|
||||
props.load(is);
|
||||
} catch (Exception ex) {
|
||||
is = new FileInputStream(conf_filename);
|
||||
props = new Properties();
|
||||
props.load(is);
|
||||
}
|
||||
Iterator<Map.Entry<Object, Object>> it = props.entrySet().iterator();
|
||||
while (it.hasNext()) {
|
||||
Map.Entry<Object, Object> entry = it.next();
|
||||
name= entry.getKey().toString();
|
||||
value = entry.getValue().toString();
|
||||
obj = this.paramTable.get(name);
|
||||
if (obj == null)
|
||||
{
|
||||
this.paramTable.put(name, value);
|
||||
}
|
||||
else if (obj instanceof String)
|
||||
{
|
||||
valueList = new ArrayList();
|
||||
valueList.add(obj);
|
||||
valueList.add(value);
|
||||
this.paramTable.put(name, valueList);
|
||||
}
|
||||
else
|
||||
{
|
||||
valueList = (ArrayList)obj;
|
||||
valueList.add(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (is != null) {
|
||||
is.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,50 +1,59 @@
|
|||
|
||||
package org.csource.fastdfs.test;
|
||||
|
||||
import java.io.*;
|
||||
import java.net.*;
|
||||
import java.util.*;
|
||||
import org.csource.common.*;
|
||||
import org.csource.fastdfs.*;
|
||||
|
||||
public class Test1
|
||||
{
|
||||
public static void main(String args[])
|
||||
{
|
||||
try
|
||||
{
|
||||
ClientGlobal.init("fdfs_client.conf");
|
||||
System.out.println("network_timeout=" + ClientGlobal.g_network_timeout + "ms");
|
||||
System.out.println("charset=" + ClientGlobal.g_charset);
|
||||
|
||||
TrackerGroup tg = new TrackerGroup(new InetSocketAddress[]{new InetSocketAddress("192.168.0.196", 22122)});
|
||||
TrackerClient tc = new TrackerClient(tg);
|
||||
|
||||
TrackerServer ts = tc.getConnection();
|
||||
if (ts == null)
|
||||
{
|
||||
System.out.println("getConnection return null");
|
||||
return;
|
||||
}
|
||||
|
||||
StorageServer ss = tc.getStoreStorage(ts);
|
||||
if (ss == null)
|
||||
{
|
||||
System.out.println("getStoreStorage return null");
|
||||
}
|
||||
|
||||
StorageClient1 sc1 = new StorageClient1(ts, ss);
|
||||
|
||||
NameValuePair[] meta_list = null; //new NameValuePair[0];
|
||||
String item = "c:/windows/system32/notepad.exe";
|
||||
String fileid = sc1.upload_file1(item, "exe", meta_list); //´ËÐÐÒì³£
|
||||
|
||||
System.out.println("Upload local file "+item+" ok, fileid="+fileid);
|
||||
}
|
||||
catch(Exception ex)
|
||||
{
|
||||
ex.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
package org.csource.fastdfs.test;
|
||||
|
||||
import java.io.*;
|
||||
import java.net.*;
|
||||
import java.util.*;
|
||||
import org.csource.common.*;
|
||||
import org.csource.fastdfs.*;
|
||||
|
||||
public class Test1
|
||||
{
|
||||
public static void main(String args[])
|
||||
{
|
||||
try
|
||||
{
|
||||
ClientGlobal.init("fdfs_client.conf");
|
||||
System.out.println("network_timeout=" + ClientGlobal.g_network_timeout + "ms");
|
||||
System.out.println("charset=" + ClientGlobal.g_charset);
|
||||
|
||||
TrackerGroup tg = new TrackerGroup(new InetSocketAddress[]{new InetSocketAddress("10.0.11.243", 22122)});
|
||||
TrackerClient tc = new TrackerClient(tg);
|
||||
|
||||
TrackerServer ts = tc.getConnection();
|
||||
if (ts == null)
|
||||
{
|
||||
System.out.println("getConnection return null");
|
||||
return;
|
||||
}
|
||||
|
||||
StorageServer ss = tc.getStoreStorage(ts);
|
||||
if (ss == null)
|
||||
{
|
||||
System.out.println("getStoreStorage return null");
|
||||
}
|
||||
|
||||
StorageClient1 sc1 = new StorageClient1(ts, ss);
|
||||
|
||||
NameValuePair[] meta_list = null; //new NameValuePair[0];
|
||||
String item;
|
||||
String fileid;
|
||||
if (System.getProperty("os.name").equalsIgnoreCase("windows"))
|
||||
{
|
||||
item = "c:/windows/system32/notepad.exe";
|
||||
fileid = sc1.upload_file1(item, "exe", meta_list);
|
||||
}
|
||||
else
|
||||
{
|
||||
item = "/etc/hosts";
|
||||
fileid = sc1.upload_file1(item, "", meta_list);
|
||||
}
|
||||
|
||||
System.out.println("Upload local file "+item+" ok, fileid="+fileid);
|
||||
}
|
||||
catch(Exception ex)
|
||||
{
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue