Skip to content

Commit 43a02f5

Browse files
committed
2 parents 1187eae + b9d55fe commit 43a02f5

23 files changed

+1942
-591
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Large diffs are not rendered by default.

library/src/com/nostra13/universalimageloader/cache/disc/BaseDiscCache.java

Lines changed: 0 additions & 70 deletions
This file was deleted.

library/src/com/nostra13/universalimageloader/cache/disc/DiscCacheAware.java

Lines changed: 52 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,29 +15,71 @@
1515
*******************************************************************************/
1616
package com.nostra13.universalimageloader.cache.disc;
1717

18+
import android.graphics.Bitmap;
19+
import com.nostra13.universalimageloader.utils.IoUtils;
20+
1821
import java.io.File;
22+
import java.io.IOException;
23+
import java.io.InputStream;
1924

2025
/**
21-
* Interface for disc cache
26+
* Interface for disk cache
2227
*
2328
* @author Sergey Tarasevich (nostra13[at]gmail[dot]com)
2429
* @since 1.0.0
2530
*/
2631
public interface DiscCacheAware {
32+
33+
/**
34+
* Returns root directory of disk cache
35+
*
36+
* @return Root directory of disk cache
37+
*/
38+
File getDirectory();
39+
40+
/**
41+
* Returns file of cached image
42+
*
43+
* @param imageUri Original image URI
44+
* @return File of cached image or <b>null</b> if image wasn't cached
45+
*/
46+
File get(String imageUri);
47+
48+
/**
49+
* Saves image stream in disk cache.
50+
*
51+
* @param imageUri Original image URI
52+
* @param imageStream Input stream of image
53+
* @param listener Listener for saving progress, can be ignored if you don't use
54+
* {@linkplain com.nostra13.universalimageloader.core.listener.ImageLoadingProgressListener
55+
* progress listener} in ImageLoader calls
56+
* @return <b>true</b> - if image was saved successfully; <b>false</b> - if image wasn't saved in disk cache.
57+
* @throws IOException
58+
*/
59+
boolean save(String imageUri, InputStream imageStream, IoUtils.CopyListener listener) throws IOException;
60+
2761
/**
28-
* This method must not to save file on file system in fact. It is called after image was cached in cache directory
29-
* and it was decoded to bitmap in memory. Such order is required to prevent possible deletion of file after it was
30-
* cached on disc and before it was tried to decode to bitmap.
62+
* Saves image bitmap in disk cache.
63+
*
64+
* @param imageUri Original image URI
65+
* @param bitmap Image bitmap
66+
* @return <b>true</b> - if bitmap was saved successfully; <b>false</b> - if bitmap wasn't saved in disk cache.
67+
* @throws IOException
3168
*/
32-
void put(String key, File file);
69+
boolean save(String imageUri, Bitmap bitmap) throws IOException;
3370

3471
/**
35-
* Returns {@linkplain File file object} appropriate incoming key.<br />
36-
* <b>NOTE:</b> Must <b>not to return</b> a null. Method must return specific {@linkplain File file object} for
37-
* incoming key whether file exists or not.
72+
* Removes image file associated with incoming URI
73+
*
74+
* @param imageUri Image URI
75+
* @return <b>true</b> - if image file is deleted successfully; <b>false</b> - if image file doesn't exist for
76+
* incoming URI or image file can't be deleted.
3877
*/
39-
File get(String key);
78+
boolean remove(String imageUri);
79+
80+
/** Closes disk cache, releases resources. */
81+
void close();
4082

41-
/** Clears cache directory */
83+
/** Clears disk cache. */
4284
void clear();
4385
}

library/src/com/nostra13/universalimageloader/cache/disc/LimitedDiscCache.java

Lines changed: 0 additions & 162 deletions
This file was deleted.

0 commit comments

Comments
 (0)