public class ClientGlobal extends Object
| Modifier and Type | Method and Description |
|---|---|
static String |
configInfo() |
static boolean |
getAntiStealToken() |
static String |
getCharset() |
static int |
getConnectTimeout() |
static int |
getNetworkTimeout() |
static String |
getSecretKey() |
static Socket |
getSocket(InetSocketAddress addr)
construct Socket object
|
static Socket |
getSocket(String ip_addr,
int port)
construct Socket object
|
static TrackerGroup |
getTrackerGroup() |
static int |
getTrackerHttpPort() |
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 |
isAntiStealToken() |
static void |
setAntiStealToken(boolean anti_steal_token) |
static void |
setCharset(String charset) |
static void |
setConnectTimeout(int connect_timeout) |
static void |
setNetworkTimeout(int network_timeout) |
static void |
setSecretKey(String secret_key) |
static void |
setTrackerGroup(TrackerGroup tracker_group) |
static void |
setTrackerHttpPort(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 connectTimeout
public static int networkTimeout
public static String charset
public static boolean antiStealToken
public static String secretKey
public static int trackerHttpPort
public static TrackerGroup trackerGroup
public static void init(String conf_filename) throws IOException, FastdfsException
conf_filename - config filenameIOException - ioexFastdfsException - myexpublic static void initByProperties(String propsFilePath) throws IOException, FastdfsException
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 - ioexFastdfsException - myexpublic static void initByProperties(Properties props) throws IOException, FastdfsException
IOExceptionFastdfsExceptionpublic static void initByTrackers(String trackerServers) throws IOException, FastdfsException
trackerServers - 例如:"10.0.11.245:22122,10.0.11.246:22122"
server的IP和端口用冒号':'分隔
server之间用逗号','分隔IOException - ioexFastdfsException - myexpublic static void initByTrackers(InetSocketAddress[] trackerAddresses) throws IOException, FastdfsException
IOExceptionFastdfsExceptionpublic 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 getConnectTimeout()
public static void setConnectTimeout(int connect_timeout)
public static int getNetworkTimeout()
public static void setNetworkTimeout(int network_timeout)
public static String getCharset()
public static void setCharset(String charset)
public static int getTrackerHttpPort()
public static void setTrackerHttpPort(int tracker_http_port)
public static boolean getAntiStealToken()
public static boolean isAntiStealToken()
public static void setAntiStealToken(boolean anti_steal_token)
public static String getSecretKey()
public static void setSecretKey(String secret_key)
public static TrackerGroup getTrackerGroup()
public static void setTrackerGroup(TrackerGroup tracker_group)
public static String configInfo()
Copyright © 2019. All rights reserved.