• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java MyException类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: get_file_info

import org.csource.common.MyException; //导入依赖的package包/类
/**
* get file info decoded from the filename, fetch from the storage if necessary
* @param group_name the group name
*	@param remote_filename the filename
* @return FileInfo object for success, return null for fail
*/
public FileInfo get_file_info(String group_name, String remote_filename) throws IOException, MyException
{
  if (remote_filename.length() < ProtoCommon.FDFS_FILE_PATH_LEN + ProtoCommon.FDFS_FILENAME_BASE64_LENGTH
                   + ProtoCommon.FDFS_FILE_EXT_NAME_MAX_LEN + 1)
  {
          this.errno = ProtoCommon.ERR_NO_EINVAL;
          return null;
  }
  
  byte[] buff = base64.decodeAuto(remote_filename.substring(ProtoCommon.FDFS_FILE_PATH_LEN, 
  	ProtoCommon.FDFS_FILE_PATH_LEN + ProtoCommon.FDFS_FILENAME_BASE64_LENGTH));
	
  long file_size = ProtoCommon.buff2long(buff, 4 * 2);
  if (((remote_filename.length() > ProtoCommon.TRUNK_LOGIC_FILENAME_LENGTH) || 
          ((remote_filename.length() > ProtoCommon.NORMAL_LOGIC_FILENAME_LENGTH) && ((file_size & ProtoCommon.TRUNK_FILE_MARK_SIZE) == 0))) || 
          ((file_size & ProtoCommon.APPENDER_FILE_SIZE) != 0))
  { //slave file or appender file
  	FileInfo fi = this.query_file_info(group_name, remote_filename);
  	if (fi == null)
  	{
  		return null;
  	}
  	return fi;
  }
  
	FileInfo fileInfo = new FileInfo(file_size, 0, 0, ProtoCommon.getIpAddress(buff, 0));
   fileInfo.setCreateTimestamp(ProtoCommon.buff2int(buff, 4));
   if ((file_size >> 63) != 0)
   {
    file_size &= 0xFFFFFFFFL;  //low 32 bits is file size
    fileInfo.setFileSize(file_size);
   }
   fileInfo.setCrc32(ProtoCommon.buff2int(buff, 4 * 4));
  
  return fileInfo;
}
 
开发者ID:youngMen1,项目名称:JAVA-,代码行数:43,代码来源:StorageClient.java


示例17: 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 local_filename  the filename on local
* @return 0 success, return none zero errno if fail
*/
public int download_file1(String file_id, String local_filename) throws IOException, MyException
{
	final long file_offset = 0;
	final long download_bytes = 0;
	
	return this.download_file1(file_id, file_offset, download_bytes, local_filename);
}
 
开发者ID:tb544731152,项目名称:iBase4J,代码行数:14,代码来源:StorageClient1.java


示例18: append_file1

import org.csource.common.MyException; //导入依赖的package包/类
/**
* append file to storage server (by file name)
* @param appender_file_id the appender file id
* @param local_filename local filename to append
* @return 0 for success, != 0 for error (error no)
*/
public int append_file1(String appender_file_id, String local_filename) 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.append_file(parts[0], parts[1], local_filename);
}
 
开发者ID:babymm,项目名称:mumu,代码行数:18,代码来源:StorageClient1.java


示例19: download_file

import org.csource.common.MyException; //导入依赖的package包/类
/**
* download file from storage server
* @param group_name the group name of storage server
*	@param remote_filename filename on storage server
* @param local_filename  filename on local
* @return 0 success, return none zero errno if fail
*/
public int download_file(String group_name, String remote_filename, 
                  String local_filename) throws IOException, MyException
{
	final long file_offset = 0;
	final long download_bytes = 0;
	return this.download_file(group_name, remote_filename, 
                  file_offset, download_bytes, local_filename);
}
 
开发者ID:babymm,项目名称:mumu,代码行数:16,代码来源:StorageClient.java


示例20: truncate_file1

import org.csource.common.MyException; //导入依赖的package包/类
/**
* truncate appender file from storage server
 * @param appender_file_id the appender file id
* @param truncated_file_size truncated file size
* @return 0 for success, none zero for fail (error code)
*/
public int truncate_file1(String appender_file_id, long truncated_file_size) 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], truncated_file_size);
}
 
开发者ID:youngMen1,项目名称:JAVA-,代码行数:18,代码来源:StorageClient1.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java LightWeightCache类代码示例发布时间:2022-05-22
下一篇:
Java SipListener类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap