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


Java IoUtils.CopyListener方法代码示例

本文整理汇总了Java中com.nostra13.universalimageloader.utils.IoUtils.CopyListener方法的典型用法代码示例。如果您正苦于以下问题:Java IoUtils.CopyListener方法的具体用法?Java IoUtils.CopyListener怎么用?Java IoUtils.CopyListener使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.nostra13.universalimageloader.utils.IoUtils的用法示例。


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

示例1: save

import com.nostra13.universalimageloader.utils.IoUtils; //导入方法依赖的package包/类
@Override
public boolean save(String imageUri, InputStream imageStream, IoUtils.CopyListener listener) throws IOException {
	File imageFile = getFile(imageUri);
	File tmpFile = new File(imageFile.getAbsolutePath() + TEMP_IMAGE_POSTFIX);
	boolean loaded = false;
	try {
		OutputStream os = new BufferedOutputStream(new FileOutputStream(tmpFile), bufferSize);
		try {
			loaded = IoUtils.copyStream(imageStream, os, listener, bufferSize);
		} finally {
			IoUtils.closeSilently(os);
		}
	} finally {
		if (loaded && !tmpFile.renameTo(imageFile)) {
			loaded = false;
		}
		if (!loaded) {
			tmpFile.delete();
		}
	}
	return loaded;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:23,代码来源:BaseDiskCache.java

示例2: save

import com.nostra13.universalimageloader.utils.IoUtils; //导入方法依赖的package包/类
@Override
public boolean save(String imageUri, InputStream imageStream, IoUtils.CopyListener listener) throws IOException {
	DiskLruCache.Editor editor = cache.edit(getKey(imageUri));
	if (editor == null) {
		return false;
	}

	OutputStream os = new BufferedOutputStream(editor.newOutputStream(0), bufferSize);
	boolean copied = false;
	try {
		copied = IoUtils.copyStream(imageStream, os, listener, bufferSize);
	} finally {
		IoUtils.closeSilently(os);
		if (copied) {
			editor.commit();
		} else {
			editor.abort();
		}
	}
	return copied;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:22,代码来源:LruDiskCache.java

示例3: save

import com.nostra13.universalimageloader.utils.IoUtils; //导入方法依赖的package包/类
@Override
public boolean save(String imageUri, InputStream imageStream, IoUtils.CopyListener listener) throws IOException {
	File imageFile = getFile(imageUri);
	File tmpFile = new File(imageFile.getAbsolutePath() + TEMP_IMAGE_POSTFIX);
	boolean loaded = false;
	try {
		OutputStream os = new BufferedOutputStream(new FileOutputStream(tmpFile), bufferSize);
		try {
			loaded = IoUtils.copyStream(imageStream, os, listener, bufferSize);
		} finally {
			IoUtils.closeSilently(os);
		}
	} finally {
		IoUtils.closeSilently(imageStream);
		if (loaded && !tmpFile.renameTo(imageFile)) {
			loaded = false;
		}
		if (!loaded) {
			tmpFile.delete();
		}
	}
	return loaded;
}
 
开发者ID:hubcarl,项目名称:mobile-manager-tool,代码行数:24,代码来源:BaseDiscCache.java

示例4: save

import com.nostra13.universalimageloader.utils.IoUtils; //导入方法依赖的package包/类
/**
 * 根据文件流进行保存到缓存文件中
 * @param imageUri    Original image URI    原图片URL地址作为生成缓存文件的文件名
 * @param imageStream Input stream of image (shouldn't be closed in this method)   图片流
 * @param listener     用于监听流保存本地的进度
 * Listener for saving progress, can be ignored if you don't use
 *                    {@linkplain com.nostra13.universalimageloader.core.listener.ImageLoadingProgressListener
 *                    progress listener} in ImageLoader calls
 * @return
 * @throws IOException
 */
@Override
public boolean save(String imageUri, InputStream imageStream, IoUtils.CopyListener listener) throws IOException {
	File imageFile = getFile(imageUri);
	File tmpFile = new File(imageFile.getAbsolutePath() + TEMP_IMAGE_POSTFIX);
	boolean loaded = false;
	try {
		OutputStream os = new BufferedOutputStream(new FileOutputStream(tmpFile), bufferSize);
		try {
			loaded = IoUtils.copyStream(imageStream, os, listener, bufferSize);
		} finally {
			IoUtils.closeSilently(os);
		}
	} finally {
		if (loaded && !tmpFile.renameTo(imageFile)) {
			loaded = false;
		}
		if (!loaded) {
			tmpFile.delete();
		}
	}
	return loaded;
}
 
开发者ID:jiangqqlmj,项目名称:Android-Universal-Image-Loader-Modify,代码行数:34,代码来源:BaseDiskCache.java

示例5: save

import com.nostra13.universalimageloader.utils.IoUtils; //导入方法依赖的package包/类
/**
 * 把图片流数据保存到缓存中
 * @param imageUri    Original image URI  图像URL连接地址
 * @param imageStream Input stream of image (shouldn't be closed in this method)  图片流
 * @param listener    图片流拷贝监听器
 * Listener for saving progress, can be ignored if you don't use
 *                    {@linkplain com.nostra13.universalimageloader.core.listener.ImageLoadingProgressListener
 *                    progress listener} in ImageLoader calls
 * @return
 * @throws IOException
 */
@Override
public boolean save(String imageUri, InputStream imageStream, IoUtils.CopyListener listener) throws IOException {
	DiskLruCache.Editor editor = cache.edit(getKey(imageUri));
	if (editor == null) {
		return false;
	}
       //流写入文件
	OutputStream os = new BufferedOutputStream(editor.newOutputStream(0), bufferSize);
	boolean copied = false;
	try {
		copied = IoUtils.copyStream(imageStream, os, listener, bufferSize);
	} finally {
		IoUtils.closeSilently(os);
		if (copied) {
			editor.commit();
		} else {
			editor.abort();
		}
	}
	return copied;
}
 
开发者ID:jiangqqlmj,项目名称:Android-Universal-Image-Loader-Modify,代码行数:33,代码来源:LruDiskCache.java

示例6: save

import com.nostra13.universalimageloader.utils.IoUtils; //导入方法依赖的package包/类
@Override
public boolean save(String imageUri, InputStream imageStream, IoUtils.CopyListener listener) throws IOException {
	File imageFile = getFile(imageUri);
	File tmpFile = new File(imageFile.getAbsolutePath() + TEMP_IMAGE_POSTFIX);
	boolean loaded = false;
	try {
		OutputStream os = new BufferedOutputStream(new FileOutputStream(tmpFile), bufferSize);
		try {
			loaded = IoUtils.copyStream(imageStream, os, listener, bufferSize);
		} finally {
			IoUtils.closeSilently(os);
		}
	}catch(Exception e){
		//TODO:sd卡已满!!
		e.printStackTrace();
		
	} finally {
		IoUtils.closeSilently(imageStream);
		if (loaded && !tmpFile.renameTo(imageFile)) {
			loaded = false;
		}
		if (!loaded) {
			tmpFile.delete();
		}
	}
	return loaded;
}
 
开发者ID:x251089003,项目名称:EveryXDay,代码行数:28,代码来源:BaseDiscCache.java

示例7: writeGif

import com.nostra13.universalimageloader.utils.IoUtils; //导入方法依赖的package包/类
public static void writeGif(String url, InputStream stream, IoUtils.CopyListener listener) {
    try {
        LogUtil.v(discCache.save(url, stream, listener) + "DONE ");
    } catch (Exception e) {
        e.printStackTrace();
    } finally {
        IoUtils.closeSilently(stream);
    }
}
 
开发者ID:ccrama,项目名称:Slide,代码行数:10,代码来源:GifCache.java

示例8: save

import com.nostra13.universalimageloader.utils.IoUtils; //导入方法依赖的package包/类
@Override
public boolean save(String imageUri, InputStream imageStream, IoUtils.CopyListener listener) throws IOException {
	boolean saved = super.save(imageUri, imageStream, listener);
	rememberUsage(imageUri);
	return saved;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:7,代码来源:LimitedAgeDiskCache.java

示例9: save

import com.nostra13.universalimageloader.utils.IoUtils; //导入方法依赖的package包/类
/**
 * 进行保存图片到本地缓存路径中  --使用图片流
 * @param imageUri       图片的URL地址
 * @param imageStream    图片流
 * @param listener       图片流拷贝完成进度回调接口
 * @return
 * @throws IOException
 */
@Override
public boolean save(String imageUri, InputStream imageStream, IoUtils.CopyListener listener) throws IOException {
	boolean saved = super.save(imageUri, imageStream, listener);
	//时间保存
	rememberUsage(imageUri);
	return saved;
}
 
开发者ID:jiangqqlmj,项目名称:Android-Universal-Image-Loader-Modify,代码行数:16,代码来源:LimitedAgeDiskCache.java

示例10: save

import com.nostra13.universalimageloader.utils.IoUtils; //导入方法依赖的package包/类
/**
 * Saves image stream in disk cache.
 * Incoming image stream shouldn't be closed in this method.
 *
 * @param imageUri    Original image URI
 * @param imageStream Input stream of image (shouldn't be closed in this method)
 * @param listener    Listener for saving progress, can be ignored if you don't use
 *                    {@linkplain com.nostra13.universalimageloader.core.listener.ImageLoadingProgressListener
 *                    progress listener} in ImageLoader calls
 * @return <b>true</b> - if image was saved successfully; <b>false</b> - if image wasn't saved in disk cache.
 * @throws java.io.IOException
 */
boolean save(String imageUri, InputStream imageStream, IoUtils.CopyListener listener) throws IOException;
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:14,代码来源:DiskCache.java

示例11: save

import com.nostra13.universalimageloader.utils.IoUtils; //导入方法依赖的package包/类
/**
 * Saves image stream in disk cache.
 * Incoming image stream shouldn't be closed in this method.
 *
 * @param imageUri    Original image URI
 * @param imageStream Input stream of image (shouldn't be closed in this method)
 * @param listener    Listener for saving progress, can be ignored if you don't use
 *                    {@linkplain com.nostra13.universalimageloader.core.listener.ImageLoadingProgressListener
 *                    progress listener} in ImageLoader calls
 * @return <b>true</b> - if image was saved successfully; <b>false</b> - if image wasn't saved in disk cache.
 * @throws IOException
 */
boolean save(String imageUri, InputStream imageStream, IoUtils.CopyListener listener) throws IOException;
 
开发者ID:macyuan,项目名称:TAG,代码行数:14,代码来源:DiskCache.java

示例12: save

import com.nostra13.universalimageloader.utils.IoUtils; //导入方法依赖的package包/类
/**
 * Saves image stream in disk cache.
 *
 * @param imageUri    Original image URI
 * @param imageStream Input stream of image
 * @param listener    Listener for saving progress, can be ignored if you don't use
 *                    {@linkplain com.nostra13.universalimageloader.core.listener.ImageLoadingProgressListener
 *                    progress listener} in ImageLoader calls
 * @return <b>true</b> - if image was saved successfully; <b>false</b> - if image wasn't saved in disk cache.
 * @throws IOException
 */
boolean save(String imageUri, InputStream imageStream, IoUtils.CopyListener listener) throws IOException;
 
开发者ID:xulailing,项目名称:android-open-project-demo-master,代码行数:13,代码来源:DiscCacheAware.java

示例13: save

import com.nostra13.universalimageloader.utils.IoUtils; //导入方法依赖的package包/类
/**
 * Saves image stream in disk cache.
 *
 * @param imageUri    Original image URI
 * @param imageStream Input stream of image
 * @param listener    Listener for saving progress, can be ignored if you don't use
 *                    {@linkplain com.nostra13.universalimageloader.core.listener.ImageLoadingProgressListener
 *                    progress listener} in ImageLoader calls
 * @return <b>true</b> - if image was saved successfully; <b>false</b> - if image wasn't saved in disk cache.
 * @throws java.io.IOException
 */
boolean save(String imageUri, InputStream imageStream, IoUtils.CopyListener listener) throws IOException;
 
开发者ID:hubcarl,项目名称:mobile-manager-tool,代码行数:13,代码来源:DiscCacheAware.java

示例14: save

import com.nostra13.universalimageloader.utils.IoUtils; //导入方法依赖的package包/类
/**
 * 进行保存图片流到缓存中
 * Saves image stream in disk cache.
 * Incoming image stream shouldn't be closed in this method.
 *
 * @param imageUri    Original image URI
 * @param imageStream Input stream of image (shouldn't be closed in this method)
 * @param listener    Listener for saving progress, can be ignored if you don't use
 *                    {@linkplain com.nostra13.universalimageloader.core.listener.ImageLoadingProgressListener
 *                    progress listener} in ImageLoader calls
 * @return <b>true</b> - if image was saved successfully; <b>false</b> - if image wasn't saved in disk cache.
 * @throws java.io.IOException
 */
boolean save(String imageUri, InputStream imageStream, IoUtils.CopyListener listener) throws IOException;
 
开发者ID:jiangqqlmj,项目名称:Android-Universal-Image-Loader-Modify,代码行数:15,代码来源:DiskCache.java


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