org.csource.fastdfs
类 StorageClient1

java.lang.Object
  继承者 org.csource.fastdfs.StorageClient
      继承者 org.csource.fastdfs.StorageClient1

public class StorageClient1
extends StorageClient

Storage client for 1 field file id: combined group name and filename

版本:
Version 1.21
作者:
Happy Fish / YuQing

嵌套类摘要
 
从类 org.csource.fastdfs.StorageClient 继承的嵌套类/接口
StorageClient.UploadBuff
 
字段摘要
static String SPLIT_GROUP_NAME_AND_FILENAME_SEPERATOR
           
 
从类 org.csource.fastdfs.StorageClient 继承的字段
base64, errno, storageServer, trackerServer
 
构造方法摘要
StorageClient1()
          constructor
StorageClient1(TrackerServer trackerServer, StorageServer storageServer)
          constructor
 
方法摘要
 int append_file1(String appender_file_id, byte[] file_buff)
          append file to storage server (by file buff)
 int append_file1(String appender_file_id, byte[] file_buff, int offset, int length)
          append file to storage server (by file buff)
 int append_file1(String appender_file_id, long file_size, UploadCallback callback)
          append file to storage server (by callback)
 int append_file1(String appender_file_id, String local_filename)
          append file to storage server (by file name)
 int delete_file1(String file_id)
          delete file from storage server
 byte[] download_file1(String file_id)
          download file from storage server
 int download_file1(String file_id, DownloadCallback callback)
          download file from storage server
 byte[] download_file1(String file_id, long file_offset, long download_bytes)
          download file from storage server
 int download_file1(String file_id, long file_offset, long download_bytes, DownloadCallback callback)
          download file from storage server
 int download_file1(String file_id, long file_offset, long download_bytes, String local_filename)
          download file from storage server
 int download_file1(String file_id, String local_filename)
          download file from storage server
 FileInfo get_file_info1(String file_id)
          get file info decoded from filename
 NameValuePair[] get_metadata1(String file_id)
          get all metadata items from storage server
 int modify_file1(String appender_file_id, long file_offset, byte[] file_buff)
          modify appender file to storage server (by file buff)
 int modify_file1(String appender_file_id, long file_offset, byte[] file_buff, int buffer_offset, int buffer_length)
          modify appender file to storage server (by file buff)
 int modify_file1(String appender_file_id, long file_offset, long modify_size, UploadCallback callback)
          modify appender file to storage server (by callback)
 int modify_file1(String appender_file_id, long file_offset, String local_filename)
          modify appender file to storage server (by file name)
 FileInfo query_file_info1(String file_id)
          get file info from storage server
 int set_metadata1(String file_id, NameValuePair[] meta_list, byte op_flag)
          set metadata items to storage server
static byte split_file_id(String file_id, String[] results)
           
 int truncate_file1(String appender_file_id)
          truncate appender file to size 0 from storage server
 int truncate_file1(String appender_file_id, long truncated_file_size)
          truncate appender file from storage server
 String upload_appender_file1(byte[] file_buff, String file_ext_name, NameValuePair[] meta_list)
          upload appender file to storage server (by file buff)
 String upload_appender_file1(String group_name, byte[] file_buff, String file_ext_name, NameValuePair[] meta_list)
          upload appender file to storage server (by file buff)
 String upload_appender_file1(String group_name, long file_size, UploadCallback callback, String file_ext_name, NameValuePair[] meta_list)
          upload appender file to storage server (by callback)
 String upload_appender_file1(String local_filename, String file_ext_name, NameValuePair[] meta_list)
          upload appender file to storage server (by file name)
 String upload_appender_file1(String group_name, String local_filename, String file_ext_name, NameValuePair[] meta_list)
          upload appender file to storage server (by file name)
 String upload_file1(byte[] file_buff, String file_ext_name, NameValuePair[] meta_list)
          upload file to storage server (by file buff)
 String upload_file1(String group_name, byte[] file_buff, String file_ext_name, NameValuePair[] meta_list)
          upload file to storage server (by file buff)
 String upload_file1(String group_name, long file_size, UploadCallback callback, String file_ext_name, NameValuePair[] meta_list)
          upload file to storage server (by callback)
 String upload_file1(String master_file_id, String prefix_name, byte[] file_buff, int offset, int length, String file_ext_name, NameValuePair[] meta_list)
          upload file to storage server (by file buff, slave file mode)
 String upload_file1(String master_file_id, String prefix_name, byte[] file_buff, String file_ext_name, NameValuePair[] meta_list)
          upload file to storage server (by file buff, slave file mode)
 String upload_file1(String master_file_id, String prefix_name, long file_size, UploadCallback callback, String file_ext_name, NameValuePair[] meta_list)
          upload file to storage server (by callback)
 String upload_file1(String local_filename, String file_ext_name, NameValuePair[] meta_list)
          upload file to storage server (by file name)
 String upload_file1(String group_name, String local_filename, String file_ext_name, NameValuePair[] meta_list)
          upload file to storage server (by file name)
 String upload_file1(String master_file_id, String prefix_name, String local_filename, String file_ext_name, NameValuePair[] meta_list)
          upload file to storage server (by file name, slave file mode)
 
从类 org.csource.fastdfs.StorageClient 继承的方法
append_file, append_file, append_file, append_file, delete_file, do_append_file, do_modify_file, do_upload_file, download_file, download_file, download_file, download_file, download_file, download_file, get_file_info, get_metadata, getErrorCode, modify_file, modify_file, modify_file, modify_file, newReadableStorageConnection, newUpdatableStorageConnection, newWritableStorageConnection, query_file_info, send_download_package, send_package, set_metadata, truncate_file, truncate_file, upload_appender_file, upload_appender_file, upload_appender_file, upload_appender_file, upload_appender_file, upload_appender_file, upload_appender_file, upload_file, upload_file, upload_file, upload_file, upload_file, upload_file, upload_file, upload_file, upload_file, upload_file, upload_file, upload_file
 
从类 java.lang.Object 继承的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

字段详细信息

SPLIT_GROUP_NAME_AND_FILENAME_SEPERATOR

public static final String SPLIT_GROUP_NAME_AND_FILENAME_SEPERATOR
另请参见:
常量字段值
构造方法详细信息

StorageClient1

public StorageClient1()
constructor


StorageClient1

public StorageClient1(TrackerServer trackerServer,
                      StorageServer storageServer)
constructor

参数:
trackerServer - the tracker server, can be null
storageServer - the storage server, can be null
方法详细信息

split_file_id

public static byte split_file_id(String file_id,
                                 String[] results)

upload_file1

public String upload_file1(String local_filename,
                           String file_ext_name,
                           NameValuePair[] meta_list)
                    throws IOException,
                           MyException
upload file to storage server (by file name)

参数:
local_filename - local filename to upload
file_ext_name - file ext name, do not include dot(.), null to extract ext name from the local filename
meta_list - meta info array
返回:
file id(including group name and filename) if success,
return null if fail
抛出:
IOException
MyException

upload_file1

public String upload_file1(String group_name,
                           String local_filename,
                           String file_ext_name,
                           NameValuePair[] meta_list)
                    throws IOException,
                           MyException
upload file to storage server (by file name)

参数:
group_name - the group name to upload file to, can be empty
local_filename - local filename to upload
file_ext_name - file ext name, do not include dot(.), null to extract ext name from the local filename
meta_list - meta info array
返回:
file id(including group name and filename) if success,
return null if fail
抛出:
IOException
MyException

upload_file1

public String upload_file1(byte[] file_buff,
                           String file_ext_name,
                           NameValuePair[] meta_list)
                    throws IOException,
                           MyException
upload file to storage server (by file buff)

参数:
file_buff - file content/buff
file_ext_name - file ext name, do not include dot(.)
meta_list - meta info array
返回:
file id(including group name and filename) if success,
return null if fail
抛出:
IOException
MyException

upload_file1

public String upload_file1(String group_name,
                           byte[] file_buff,
                           String file_ext_name,
                           NameValuePair[] meta_list)
                    throws IOException,
                           MyException
upload file to storage server (by file buff)

参数:
group_name - the group name to upload file to, can be empty
file_buff - file content/buff
file_ext_name - file ext name, do not include dot(.)
meta_list - meta info array
返回:
file id(including group name and filename) if success,
return null if fail
抛出:
IOException
MyException

upload_file1

public String upload_file1(String group_name,
                           long file_size,
                           UploadCallback callback,
                           String file_ext_name,
                           NameValuePair[] meta_list)
                    throws IOException,
                           MyException
upload file to storage server (by callback)

参数:
group_name - the group name to upload file to, can be empty
file_size - the file size
callback - the write data callback object
file_ext_name - file ext name, do not include dot(.)
meta_list - meta info array
返回:
file id(including group name and filename) if success,
return null if fail
抛出:
IOException
MyException

upload_appender_file1

public String upload_appender_file1(String local_filename,
                                    String file_ext_name,
                                    NameValuePair[] meta_list)
                             throws IOException,
                                    MyException
upload appender file to storage server (by file name)

参数:
local_filename - local filename to upload
file_ext_name - file ext name, do not include dot(.), null to extract ext name from the local filename
meta_list - meta info array
返回:
file id(including group name and filename) if success,
return null if fail
抛出:
IOException
MyException

upload_appender_file1

public String upload_appender_file1(String group_name,
                                    String local_filename,
                                    String file_ext_name,
                                    NameValuePair[] meta_list)
                             throws IOException,
                                    MyException
upload appender file to storage server (by file name)

参数:
group_name - the group name to upload file to, can be empty
local_filename - local filename to upload
file_ext_name - file ext name, do not include dot(.), null to extract ext name from the local filename
meta_list - meta info array
返回:
file id(including group name and filename) if success,
return null if fail
抛出:
IOException
MyException

upload_appender_file1

public String upload_appender_file1(byte[] file_buff,
                                    String file_ext_name,
                                    NameValuePair[] meta_list)
                             throws IOException,
                                    MyException
upload appender file to storage server (by file buff)

参数:
file_buff - file content/buff
file_ext_name - file ext name, do not include dot(.)
meta_list - meta info array
返回:
file id(including group name and filename) if success,
return null if fail
抛出:
IOException
MyException

upload_appender_file1

public String upload_appender_file1(String group_name,
                                    byte[] file_buff,
                                    String file_ext_name,
                                    NameValuePair[] meta_list)
                             throws IOException,
                                    MyException
upload appender file to storage server (by file buff)

参数:
group_name - the group name to upload file to, can be empty
file_buff - file content/buff
file_ext_name - file ext name, do not include dot(.)
meta_list - meta info array
返回:
file id(including group name and filename) if success,
return null if fail
抛出:
IOException
MyException

upload_appender_file1

public String upload_appender_file1(String group_name,
                                    long file_size,
                                    UploadCallback callback,
                                    String file_ext_name,
                                    NameValuePair[] meta_list)
                             throws IOException,
                                    MyException
upload appender file to storage server (by callback)

参数:
group_name - the group name to upload file to, can be empty
file_size - the file size
callback - the write data callback object
file_ext_name - file ext name, do not include dot(.)
meta_list - meta info array
返回:
file id(including group name and filename) if success,
return null if fail
抛出:
IOException
MyException

upload_file1

public String upload_file1(String master_file_id,
                           String prefix_name,
                           String local_filename,
                           String file_ext_name,
                           NameValuePair[] meta_list)
                    throws IOException,
                           MyException
upload file to storage server (by file name, slave file mode)

参数:
master_file_id - the master file id to generate the slave file
prefix_name - the prefix name to generate the slave file
local_filename - local filename to upload
file_ext_name - file ext name, do not include dot(.), null to extract ext name from the local filename
meta_list - meta info array
返回:
file id(including group name and filename) if success,
return null if fail
抛出:
IOException
MyException

upload_file1

public String upload_file1(String master_file_id,
                           String prefix_name,
                           byte[] file_buff,
                           String file_ext_name,
                           NameValuePair[] meta_list)
                    throws IOException,
                           MyException
upload file to storage server (by file buff, slave file mode)

参数:
master_file_id - the master file id to generate the slave file
prefix_name - the prefix name to generate the slave file
file_buff - file content/buff
file_ext_name - file ext name, do not include dot(.)
meta_list - meta info array
返回:
file id(including group name and filename) if success,
return null if fail
抛出:
IOException
MyException

upload_file1

public String upload_file1(String master_file_id,
                           String prefix_name,
                           byte[] file_buff,
                           int offset,
                           int length,
                           String file_ext_name,
                           NameValuePair[] meta_list)
                    throws IOException,
                           MyException
upload file to storage server (by file buff, slave file mode)

参数:
master_file_id - the master file id to generate the slave file
prefix_name - the prefix name to generate the slave file
file_buff - file content/buff
file_ext_name - file ext name, do not include dot(.)
meta_list - meta info array
返回:
file id(including group name and filename) if success,
return null if fail
抛出:
IOException
MyException

upload_file1

public String upload_file1(String master_file_id,
                           String prefix_name,
                           long file_size,
                           UploadCallback callback,
                           String file_ext_name,
                           NameValuePair[] meta_list)
                    throws IOException,
                           MyException
upload file to storage server (by callback)

参数:
master_file_id - the master file id to generate the slave file
prefix_name - the prefix name to generate the slave file
file_size - the file size
callback - the write data callback object
file_ext_name - file ext name, do not include dot(.)
meta_list - meta info array
返回:
file id(including group name and filename) if success,
return null if fail
抛出:
IOException
MyException

append_file1

public int append_file1(String appender_file_id,
                        String local_filename)
                 throws IOException,
                        MyException
append file to storage server (by file name)

参数:
appender_file_id - the appender file id
local_filename - local filename to append
返回:
0 for success, != 0 for error (error no)
抛出:
IOException
MyException

append_file1

public int append_file1(String appender_file_id,
                        byte[] file_buff)
                 throws IOException,
                        MyException
append file to storage server (by file buff)

参数:
appender_file_id - the appender file id
file_buff - file content/buff
返回:
0 for success, != 0 for error (error no)
抛出:
IOException
MyException

append_file1

public int append_file1(String appender_file_id,
                        byte[] file_buff,
                        int offset,
                        int length)
                 throws IOException,
                        MyException
append file to storage server (by file buff)

参数:
appender_file_id - the appender file id
file_buff - file content/buffer
offset - start offset of the buffer
length - the length of the buffer to append
返回:
0 for success, != 0 for error (error no)
抛出:
IOException
MyException

append_file1

public int append_file1(String appender_file_id,
                        long file_size,
                        UploadCallback callback)
                 throws IOException,
                        MyException
append file to storage server (by callback)

参数:
appender_file_id - the appender file id
file_size - the file size
callback - the write data callback object
返回:
0 for success, != 0 for error (error no)
抛出:
IOException
MyException

modify_file1

public int modify_file1(String appender_file_id,
                        long file_offset,
                        String local_filename)
                 throws IOException,
                        MyException
modify appender file to storage server (by file name)

参数:
appender_file_id - the appender file id
file_offset - the offset of appender file
local_filename - local filename to append
返回:
0 for success, != 0 for error (error no)
抛出:
IOException
MyException

modify_file1

public int modify_file1(String appender_file_id,
                        long file_offset,
                        byte[] file_buff)
                 throws IOException,
                        MyException
modify appender file to storage server (by file buff)

参数:
appender_file_id - the appender file id
file_offset - the offset of appender file
file_buff - file content/buff
返回:
0 for success, != 0 for error (error no)
抛出:
IOException
MyException

modify_file1

public int modify_file1(String appender_file_id,
                        long file_offset,
                        byte[] file_buff,
                        int buffer_offset,
                        int buffer_length)
                 throws IOException,
                        MyException
modify appender file to storage server (by file buff)

参数:
appender_file_id - the appender file id
file_offset - the offset of appender file
file_buff - file content/buff
buffer_offset - start offset of the buff
buffer_length - the length of buff to modify
返回:
0 for success, != 0 for error (error no)
抛出:
IOException
MyException

modify_file1

public int modify_file1(String appender_file_id,
                        long file_offset,
                        long modify_size,
                        UploadCallback callback)
                 throws IOException,
                        MyException
modify appender file to storage server (by callback)

参数:
appender_file_id - the appender file id
file_offset - the offset of appender file
modify_size - the modify size
callback - the write data callback object
返回:
0 for success, != 0 for error (error no)
抛出:
IOException
MyException

delete_file1

public int delete_file1(String file_id)
                 throws IOException,
                        MyException
delete file from storage server

参数:
file_id - the file id(including group name and filename)
返回:
0 for success, none zero for fail (error code)
抛出:
IOException
MyException

truncate_file1

public int truncate_file1(String appender_file_id)
                   throws IOException,
                          MyException
truncate appender file to size 0 from storage server

参数:
appender_file_id - the appender file id
返回:
0 for success, none zero for fail (error code)
抛出:
IOException
MyException

truncate_file1

public int truncate_file1(String appender_file_id,
                          long truncated_file_size)
                   throws IOException,
                          MyException
truncate appender file from storage server

参数:
appender_file_id - the appender file id
truncated_file_size - truncated file size
返回:
0 for success, none zero for fail (error code)
抛出:
IOException
MyException

download_file1

public byte[] download_file1(String file_id)
                      throws IOException,
                             MyException
download file from storage server

参数:
file_id - the file id(including group name and filename)
返回:
file content/buffer, return null if fail
抛出:
IOException
MyException

download_file1

public byte[] download_file1(String file_id,
                             long file_offset,
                             long download_bytes)
                      throws IOException,
                             MyException
download file from storage server

参数:
file_id - the file id(including group name and filename)
file_offset - the start offset of the file
download_bytes - download bytes, 0 for remain bytes from offset
返回:
file content/buff, return null if fail
抛出:
IOException
MyException

download_file1

public int download_file1(String file_id,
                          String local_filename)
                   throws IOException,
                          MyException
download file from storage server

参数:
file_id - the file id(including group name and filename)
local_filename - the filename on local
返回:
0 success, return none zero errno if fail
抛出:
IOException
MyException

download_file1

public int download_file1(String file_id,
                          long file_offset,
                          long download_bytes,
                          String local_filename)
                   throws IOException,
                          MyException
download file from storage server

参数:
file_id - the file id(including group name and filename)
file_offset - the start offset of the file
download_bytes - download bytes, 0 for remain bytes from offset
local_filename - the filename on local
返回:
0 success, return none zero errno if fail
抛出:
IOException
MyException

download_file1

public int download_file1(String file_id,
                          DownloadCallback callback)
                   throws IOException,
                          MyException
download file from storage server

参数:
file_id - the file id(including group name and filename)
callback - the callback object, will call callback.recv() when data arrive
返回:
0 success, return none zero errno if fail
抛出:
IOException
MyException

download_file1

public int download_file1(String file_id,
                          long file_offset,
                          long download_bytes,
                          DownloadCallback callback)
                   throws IOException,
                          MyException
download file from storage server

参数:
file_id - the file id(including group name and filename)
file_offset - the start offset of the file
download_bytes - download bytes, 0 for remain bytes from offset
callback - the callback object, will call callback.recv() when data arrive
返回:
0 success, return none zero errno if fail
抛出:
IOException
MyException

get_metadata1

public NameValuePair[] get_metadata1(String file_id)
                              throws IOException,
                                     MyException
get all metadata items from storage server

参数:
file_id - the file id(including group name and filename)
返回:
meta info array, return null if fail
抛出:
IOException
MyException

set_metadata1

public int set_metadata1(String file_id,
                         NameValuePair[] meta_list,
                         byte op_flag)
                  throws IOException,
                         MyException
set metadata items to storage server

参数:
file_id - the file id(including group name and filename)
meta_list - meta item array
op_flag - flag, can be one of following values:
  • ProtoCommon.STORAGE_SET_METADATA_FLAG_OVERWRITE: overwrite all old metadata items
  • ProtoCommon.STORAGE_SET_METADATA_FLAG_MERGE: merge, insert when the metadata item not exist, otherwise update it
返回:
0 for success, !=0 fail (error code)
抛出:
IOException
MyException

query_file_info1

public FileInfo query_file_info1(String file_id)
                          throws IOException,
                                 MyException
get file info from storage server

参数:
file_id - the file id(including group name and filename)
返回:
FileInfo object for success, return null for fail
抛出:
IOException
MyException

get_file_info1

public FileInfo get_file_info1(String file_id)
                        throws IOException,
                               MyException
get file info decoded from filename

参数:
file_id - the file id(including group name and filename)
返回:
FileInfo object for success, return null for fail
抛出:
IOException
MyException


Copyright © 2017. All rights reserved.