本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
}
示例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;
}
示例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;
}
示例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;
示例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;
示例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;
示例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;
示例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;