public class ClientGlobal extends Object
| Modifier and Type | Method and Description |
|---|---|
static String |
configInfo() |
static boolean |
getG_anti_steal_token() |
static String |
getG_charset() |
static int |
getG_connect_timeout() |
static int |
getG_network_timeout() |
static String |
getG_secret_key() |
static TrackerGroup |
getG_tracker_group() |
static int |
getG_tracker_http_port() |
static Socket |
getSocket(InetSocketAddress addr)
construct Socket object
|
static Socket |
getSocket(String ip_addr,
int port)
construct Socket object
|
static void |
init(String conf_filename)
load global variables
|
static void |
initByProperties(Properties props) |
static void |
initByProperties(String propsFilePath)
load from properties file
|
static void |
initByTrackers(InetSocketAddress[] trackerAddresses) |
static void |
initByTrackers(String trackerServers)
load from properties file
|
static boolean |
isG_anti_steal_token() |
static void |
setG_anti_steal_token(boolean anti_steal_token) |
static void |
setG_charset(String charset) |
static void |
setG_connect_timeout(int connect_timeout) |
static void |
setG_network_timeout(int network_timeout) |
static void |
setG_secret_key(String secret_key) |
static void |
setG_tracker_group(TrackerGroup tracker_group) |
static void |
setG_tracker_http_port(int tracker_http_port) |
public static final String CONF_KEY_CONNECT_TIMEOUT
public static final String CONF_KEY_NETWORK_TIMEOUT
public static final String CONF_KEY_CHARSET
public static final String CONF_KEY_HTTP_ANTI_STEAL_TOKEN
public static final String CONF_KEY_HTTP_SECRET_KEY
public static final String CONF_KEY_HTTP_TRACKER_HTTP_PORT
public static final String CONF_KEY_TRACKER_SERVER
public static final String PROP_KEY_CONNECT_TIMEOUT_IN_SECONDS
public static final String PROP_KEY_NETWORK_TIMEOUT_IN_SECONDS
public static final String PROP_KEY_CHARSET
public static final String PROP_KEY_HTTP_ANTI_STEAL_TOKEN
public static final String PROP_KEY_HTTP_SECRET_KEY
public static final String PROP_KEY_HTTP_TRACKER_HTTP_PORT
public static final String PROP_KEY_TRACKER_SERVERS
public static final int DEFAULT_CONNECT_TIMEOUT
public static final int DEFAULT_NETWORK_TIMEOUT
public static final String DEFAULT_CHARSET
public static final boolean DEFAULT_HTTP_ANTI_STEAL_TOKEN
public static final String DEFAULT_HTTP_SECRET_KEY
public static final int DEFAULT_HTTP_TRACKER_HTTP_PORT
public static int g_connect_timeout
public static int g_network_timeout
public static String g_charset
public static boolean g_anti_steal_token
public static String g_secret_key
public static int g_tracker_http_port
public static TrackerGroup g_tracker_group
public static void init(String conf_filename) throws IOException, MyException
conf_filename - config filenameIOException - ioexMyException - myexpublic static void initByProperties(String propsFilePath) throws IOException, MyException
propsFilePath - properties file path, eg:
"fastdfs-client.properties"
"config/fastdfs-client.properties"
"/opt/fastdfs-client.properties"
"C:\\Users\\James\\config\\fastdfs-client.properties"
properties文件至少包含一个配置项 fastdfs.tracker_servers 例如:
fastdfs.tracker_servers = 10.0.11.245:22122,10.0.11.246:22122
server的IP和端口用冒号':'分隔
server之间用逗号','分隔IOException - ioexMyException - myexpublic static void initByProperties(Properties props) throws IOException, MyException
IOExceptionMyExceptionpublic static void initByTrackers(String trackerServers) throws IOException, MyException
trackerServers - 例如:"10.0.11.245:22122,10.0.11.246:22122"
server的IP和端口用冒号':'分隔
server之间用逗号','分隔IOException - ioexMyException - myexpublic static void initByTrackers(InetSocketAddress[] trackerAddresses) throws IOException, MyException
IOExceptionMyExceptionpublic static Socket getSocket(String ip_addr, int port) throws IOException
ip_addr - ip address or hostnameport - port numberIOException - ioexpublic static Socket getSocket(InetSocketAddress addr) throws IOException
addr - InetSocketAddress object, including ip address and portIOException - ioexpublic static int getG_connect_timeout()
public static void setG_connect_timeout(int connect_timeout)
public static int getG_network_timeout()
public static void setG_network_timeout(int network_timeout)
public static String getG_charset()
public static void setG_charset(String charset)
public static int getG_tracker_http_port()
public static void setG_tracker_http_port(int tracker_http_port)
public static boolean getG_anti_steal_token()
public static boolean isG_anti_steal_token()
public static void setG_anti_steal_token(boolean anti_steal_token)
public static String getG_secret_key()
public static void setG_secret_key(String secret_key)
public static TrackerGroup getG_tracker_group()
public static void setG_tracker_group(TrackerGroup tracker_group)
public static String configInfo()
Copyright © 2019. All rights reserved.