当前位置: 首页>>代码示例>>Java>>正文


Java MyException类代码示例

本文整理汇总了Java中org.csource.common.MyException的典型用法代码示例。如果您正苦于以下问题:Java MyException类的具体用法?Java MyException怎么用?Java MyException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


MyException类属于org.csource.common包,在下文中一共展示了MyException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: upload_file

import org.csource.common.MyException; //导入依赖的package包/类
/**
* upload file to storage server (by file name)
* @param cmd the command
* @param group_name the group name to upload file to, can be empty
* @param local_filename local filename to upload
* @param file_ext_name file ext name, do not include dot(.), null to extract ext name from the local filename
* @param meta_list meta info array
* @return  2 elements string array if success:<br>
*           <ul><li>results[0]: the group name to store the file </li></ul>
*           <ul><li>results[1]: the new created filename</li></ul>
*         return null if fail
 * @throws IOException if an error occurred
 * @throws MyException if an error occurred
*/
protected String[] upload_file(byte cmd, String group_name, String local_filename, String file_ext_name,
    NameValuePair[] meta_list) throws IOException, MyException {
    File f = new File(local_filename);
    FileInputStream fis = new FileInputStream(f);

    if (file_ext_name == null) {
        int nPos = local_filename.lastIndexOf('.');
        if (nPos > 0 && local_filename.length() - nPos <= ProtoCommon.FDFS_FILE_EXT_NAME_MAX_LEN + 1) {
            file_ext_name = local_filename.substring(nPos + 1);
        }
    }

    try {
        return this.do_upload_file(cmd, group_name, null, null, file_ext_name, f.length(),
            new UploadStream(fis, f.length()), meta_list);
    } finally {
        fis.close();
    }
}
 
开发者ID:iBase4J,项目名称:iBase4J-Common,代码行数:34,代码来源:StorageClient.java

示例2: newWritableStorageConnection

import org.csource.common.MyException; //导入依赖的package包/类
/**
* check storage socket, if null create a new connection
* @param group_name the group name to upload file to, can be empty
* @return true if create a new connection
*/
protected boolean newWritableStorageConnection(String group_name) throws IOException, MyException
{
	if (this.storageServer != null)
	{
		return false;
	}
	else
	{
		TrackerClient tracker = new TrackerClient();
 		this.storageServer = tracker.getStoreStorage(this.trackerServer, group_name);
 		if (this.storageServer == null)
 		{
 			throw new MyException("getStoreStorage fail, errno code: " + tracker.getErrorCode());
 		}
 		return true;
	}
 }
 
开发者ID:tb544731152,项目名称:iBase4J,代码行数:23,代码来源:StorageClient.java

示例3: check

import org.csource.common.MyException; //导入依赖的package包/类
private void check() throws MyException
{
   if (this.namespace.length > ProtoCommon.FDHT_MAX_NAMESPACE_LEN)
   {
   	namespace_len = ProtoCommon.FDHT_MAX_NAMESPACE_LEN;
   }
   else
   {
   	namespace_len = this.namespace.length;
   }

   if (this.object_id.length > ProtoCommon.FDHT_MAX_OBJECT_ID_LEN)
   {
   	obj_id_len = ProtoCommon.FDHT_MAX_OBJECT_ID_LEN;
   }
   else
   {
   	obj_id_len = this.object_id.length;
   }
       
   if (namespace_len == 0 || obj_id_len == 0)
   {
     throw new MyException("Invalid namespace length: " + this.namespace.length
     						 + " and object ID length: " + this.object_id.length);
   }
}
 
开发者ID:youngMen1,项目名称:JAVA-,代码行数:27,代码来源:ObjectInfo.java

示例4: modify_file

import org.csource.common.MyException; //导入依赖的package包/类
/**
* modify appender file to storage server (by file name)
* @param group_name the group name of appender file
* @param appender_filename the appender filename
* @param file_offset the offset of appender file
* @param local_filename local filename to append
* @return 0 for success, != 0 for error (error no)
*/
public int modify_file(String group_name, String appender_filename, 
		long file_offset, String local_filename) throws IOException, MyException
{
	File f = new File(local_filename);
	FileInputStream fis = new FileInputStream(f);
	
	try
	{
	  return this.do_modify_file(group_name, appender_filename, file_offset, 
		  	f.length(), new UploadStream(fis, f.length()));
	}
	finally
	{
		fis.close();
	}
}
 
开发者ID:yinwq0558,项目名称:fastdfs-client-java,代码行数:25,代码来源:StorageClient.java

示例5: newUpdatableStorageConnection

import org.csource.common.MyException; //导入依赖的package包/类
/**
* check storage socket, if null create a new connection
* @param group_name the group name of storage server
*	@param remote_filename filename on storage server
* @return true if create a new connection
*/
protected boolean newUpdatableStorageConnection(String group_name, String remote_filename) throws IOException, MyException
{
	if (this.storageServer != null)
	{
		return false;
	}
	else
	{
		TrackerClient tracker = new TrackerClient();
 		this.storageServer = tracker.getUpdateStorage(this.trackerServer, group_name, remote_filename);
 		if (this.storageServer == null)
 		{
 			throw new MyException("getStoreStorage fail, errno code: " + tracker.getErrorCode());
 		}
 		return true;
	}
 }
 
开发者ID:tb544731152,项目名称:iBase4J,代码行数:24,代码来源:StorageClient.java

示例6: newReadableStorageConnection

import org.csource.common.MyException; //导入依赖的package包/类
/**
* check storage socket, if null create a new connection
* @param group_name the group name of storage server
*	@param remote_filename filename on storage server
* @return true if create a new connection
*/
protected boolean newReadableStorageConnection(String group_name, String remote_filename) throws IOException, MyException
{
	if (this.storageServer != null)
	{
		return false;
	}
	else
	{
		TrackerClient tracker = new TrackerClient();
 		this.storageServer = tracker.getFetchStorage(this.trackerServer, group_name, remote_filename);
 		if (this.storageServer == null)
 		{
 			throw new MyException("getStoreStorage fail, errno code: " + tracker.getErrorCode());
 		}
 		return true;
	}
 }
 
开发者ID:guokezheng,项目名称:automat,代码行数:24,代码来源:StorageClient.java

示例7: upload_file1

import org.csource.common.MyException; //导入依赖的package包/类
/**
* upload file to storage server (by file buff, slave file mode)
* @param master_file_id the master file id to generate the slave file
* @param prefix_name the prefix name to generate the slave file
* @param file_buff file content/buff
* @param file_ext_name file ext name, do not include dot(.)
*	@param meta_list meta info array
* @return  file id(including group name and filename) if success, <br>
*         return null if fail
*/
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
{
	String[] parts = new String[2];
	this.errno = this.split_file_id(master_file_id, parts);
	if (this.errno != 0)
	{
		return null;
	}
	
	parts = this.upload_file(parts[0], parts[1], prefix_name, file_buff, 
	             offset, length, file_ext_name, meta_list);
	if (parts != null)
	{
		return parts[0] + SPLIT_GROUP_NAME_AND_FILENAME_SEPERATOR + parts[1];
	}
	else
	{
		return null;
	}
}
 
开发者ID:youngMen1,项目名称:JAVA-,代码行数:33,代码来源:StorageClient1.java

示例8: upload_file1

import org.csource.common.MyException; //导入依赖的package包/类
/**
* upload file to storage server (by callback)
* @param master_file_id the master file id to generate the slave file
* @param prefix_name the prefix name to generate the slave file
* @param file_size the file size
* @param callback the write data callback object
* @param file_ext_name file ext name, do not include dot(.)
*	@param meta_list meta info array
 * @return file id(including group name and filename) if success, <br>
*         return null if fail
*/
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
{
	String[] parts = new String[2];
	this.errno = this.split_file_id(master_file_id, parts);
	if (this.errno != 0)
	{
		return null;
	}
	
	parts = this.upload_file(parts[0], parts[1], prefix_name, file_size, callback, file_ext_name, meta_list);
	if (parts != null)
	{
		return parts[0] + SPLIT_GROUP_NAME_AND_FILENAME_SEPERATOR + parts[1];
	}
	else
	{
		return null;
	}
}
 
开发者ID:babymm,项目名称:mumu,代码行数:33,代码来源:StorageClient1.java

示例9: upload_file

import org.csource.common.MyException; //导入依赖的package包/类
/**
* upload file to storage server (by file name)
* @param cmd the command
* @param group_name the group name to upload file to, can be empty
* @param local_filename local filename to upload
* @param file_ext_name file ext name, do not include dot(.), null to extract ext name from the local filename
* @param meta_list meta info array
* @return  2 elements string array if success:<br>
*           <ul><li>results[0]: the group name to store the file </li></ul>
*           <ul><li>results[1]: the new created filename</li></ul>
*         return null if fail
*/
protected String[] upload_file(byte cmd, String group_name, String local_filename, String file_ext_name, 
       NameValuePair[] meta_list) throws IOException, MyException
{
	File f = new File(local_filename);
	FileInputStream fis = new FileInputStream(f);
	
	if (file_ext_name == null)
	{
		int nPos = local_filename.lastIndexOf('.');
		if (nPos > 0 && local_filename.length() - nPos <= ProtoCommon.FDFS_FILE_EXT_NAME_MAX_LEN + 1)
		{
			file_ext_name = local_filename.substring(nPos+1);
		}
	}
	
	try
	{
	  return this.do_upload_file(cmd, group_name, null, null, file_ext_name, 
	           f.length(), new UploadStream(fis, f.length()), meta_list);
	}
	finally
	{
		fis.close();
	}
}
 
开发者ID:guokezheng,项目名称:automat,代码行数:38,代码来源:StorageClient.java

示例10: truncate_file1

import org.csource.common.MyException; //导入依赖的package包/类
/**
* truncate appender file to size 0 from storage server
 * @param appender_file_id the appender file id
* @return 0 for success, none zero for fail (error code)
*/
public int truncate_file1(String appender_file_id) throws IOException, MyException
{
	String[] parts = new String[2];
	this.errno = this.split_file_id(appender_file_id, parts);
	if (this.errno != 0)
	{
		return this.errno;
	}
	
	return this.truncate_file(parts[0], parts[1]);
}
 
开发者ID:babymm,项目名称:mumu,代码行数:17,代码来源:StorageClient1.java

示例11: modify_file1

import org.csource.common.MyException; //导入依赖的package包/类
/**
* modify appender file to storage server (by file buff)
* @param appender_file_id the appender file id
* @param file_offset the offset of appender file
* @param file_buff file content/buff
* @param buffer_offset start offset of the buff
* @param buffer_length the length of buff to modify
* @return 0 for success, != 0 for error (error no)
*/
public int modify_file1(String appender_file_id, 
       long file_offset, byte[] file_buff, int buffer_offset, int buffer_length) throws IOException, MyException
{
	String[] parts = new String[2];
	this.errno = this.split_file_id(appender_file_id, parts);
	if (this.errno != 0)
	{
		return this.errno;
	}
	
	return this.modify_file(parts[0], parts[1], file_offset, 
			file_buff, buffer_offset, buffer_length);
}
 
开发者ID:guokezheng,项目名称:automat,代码行数:23,代码来源:StorageClient1.java

示例12: download_file1

import org.csource.common.MyException; //导入依赖的package包/类
/**
* download file from storage server
* @param file_id the file id(including group name and filename)
* @param file_offset the start offset of the file
* @param download_bytes download bytes, 0 for remain bytes from offset
* @param local_filename  the filename on local
* @return 0 success, return none zero errno if fail
*/
public int download_file1(String file_id, long file_offset, long download_bytes, String local_filename) throws IOException, MyException
{
	String[] parts = new String[2];
	this.errno = this.split_file_id(file_id, parts);
	if (this.errno != 0)
	{
		return this.errno;
	}
	
	return this.download_file(parts[0], parts[1], file_offset, download_bytes, local_filename);
}
 
开发者ID:youngMen1,项目名称:JAVA-,代码行数:20,代码来源:StorageClient1.java

示例13: upload_appender_file1

import org.csource.common.MyException; //导入依赖的package包/类
/**
* upload appender file to storage server (by file name)
* @param local_filename local filename to upload
* @param file_ext_name file ext name, do not include dot(.), null to extract ext name from the local filename
* @param meta_list meta info array
* @return  file id(including group name and filename) if success, <br>
*         return null if fail
*/
public String upload_appender_file1(String local_filename, String file_ext_name, 
       NameValuePair[] meta_list) throws IOException, MyException
{
	String parts[] = this.upload_appender_file(local_filename, file_ext_name, meta_list);
	if (parts != null)
	{
		return parts[0] + SPLIT_GROUP_NAME_AND_FILENAME_SEPERATOR + parts[1];
	}
	else
	{
		return null;
	}
}
 
开发者ID:babymm,项目名称:mumu,代码行数:22,代码来源:StorageClient1.java

示例14: get

import org.csource.common.MyException; //导入依赖的package包/类
/**
 * retrieve value of key
 *
 * @param keyInfo the key to get
 * @param expires expire timestamp, ProtoCommon.FDHT_EXPIRES_NONE for not change the expired time
 * @return none null for success, null for fail
 */
public String get(KeyInfo keyInfo, int expires) throws UnsupportedEncodingException, MyException {
    byte[] bs;
    bs = this.getBytes(keyInfo, expires);
    if (bs == null) {
        return null;
    }

    return new String(bs, ClientGlobal.g_charset);
}
 
开发者ID:youngMen1,项目名称:JAVA-,代码行数:17,代码来源:FastDHTClient.java

示例15: KeyInfo

import org.csource.common.MyException; //导入依赖的package包/类
public KeyInfo(String namespace, String object_id, String key) throws UnsupportedEncodingException, MyException
{
	this.namespace = namespace.getBytes(ClientGlobal.g_charset);
	this.object_id = object_id.getBytes(ClientGlobal.g_charset);
	this.key = key.getBytes(ClientGlobal.g_charset);
	this.check();
}
 
开发者ID:guokezheng,项目名称:automat,代码行数:8,代码来源:KeyInfo.java


注:本文中的org.csource.common.MyException类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。