forked from stephanenicolas/robospice
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bl.txt
149 lines (149 loc) · 33.1 KB
/
bl.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
74a5c4b2 robospice-cache-parent/robospice-cache/src/com/octo/android/robospice/persistence/file/InFileObjectPersisterFactory.java (Stéphane Nicolas 2012-12-17 16:39:07 +0100 1) package com.octo.android.robospice.persistence.file;
74a5c4b2 robospice-cache-parent/robospice-cache/src/com/octo/android/robospice/persistence/file/InFileObjectPersisterFactory.java (Stéphane Nicolas 2012-12-17 16:39:07 +0100 2)
d0c2991d robospice-cache-parent/robospice-cache/src/main/java/com/octo/android/robospice/persistence/file/InFileObjectPersisterFactory.java (Stéphane Nicolas 2013-06-01 19:15:50 +0200 3) import java.io.File;
d0c2991d robospice-cache-parent/robospice-cache/src/main/java/com/octo/android/robospice/persistence/file/InFileObjectPersisterFactory.java (Stéphane Nicolas 2013-06-01 19:15:50 +0200 4) import java.io.FileFilter;
74a5c4b2 robospice-cache-parent/robospice-cache/src/com/octo/android/robospice/persistence/file/InFileObjectPersisterFactory.java (Stéphane Nicolas 2012-12-17 16:39:07 +0100 5) import java.util.List;
74a5c4b2 robospice-cache-parent/robospice-cache/src/com/octo/android/robospice/persistence/file/InFileObjectPersisterFactory.java (Stéphane Nicolas 2012-12-17 16:39:07 +0100 6)
d0c2991d robospice-cache-parent/robospice-cache/src/main/java/com/octo/android/robospice/persistence/file/InFileObjectPersisterFactory.java (Stéphane Nicolas 2013-06-01 19:15:50 +0200 7) import roboguice.util.temp.Ln;
74a5c4b2 robospice-cache-parent/robospice-cache/src/com/octo/android/robospice/persistence/file/InFileObjectPersisterFactory.java (Stéphane Nicolas 2012-12-17 16:39:07 +0100 8) import android.app.Application;
74a5c4b2 robospice-cache-parent/robospice-cache/src/com/octo/android/robospice/persistence/file/InFileObjectPersisterFactory.java (Stéphane Nicolas 2012-12-17 16:39:07 +0100 9)
d0c2991d robospice-cache-parent/robospice-cache/src/main/java/com/octo/android/robospice/persistence/file/InFileObjectPersisterFactory.java (Stéphane Nicolas 2013-06-01 19:15:50 +0200 10) import com.octo.android.robospice.persistence.CacheCleaner;
74a5c4b2 robospice-cache-parent/robospice-cache/src/com/octo/android/robospice/persistence/file/InFileObjectPersisterFactory.java (Stéphane Nicolas 2012-12-17 16:39:07 +0100 11) import com.octo.android.robospice.persistence.ObjectPersister;
74a5c4b2 robospice-cache-parent/robospice-cache/src/com/octo/android/robospice/persistence/file/InFileObjectPersisterFactory.java (Stéphane Nicolas 2012-12-17 16:39:07 +0100 12) import com.octo.android.robospice.persistence.ObjectPersisterFactory;
d0c2991d robospice-cache-parent/robospice-cache/src/main/java/com/octo/android/robospice/persistence/file/InFileObjectPersisterFactory.java (Stéphane Nicolas 2013-06-01 19:15:50 +0200 13) import com.octo.android.robospice.persistence.exception.CacheCreationException;
d0c2991d robospice-cache-parent/robospice-cache/src/main/java/com/octo/android/robospice/persistence/file/InFileObjectPersisterFactory.java (Stéphane Nicolas 2013-06-01 19:15:50 +0200 14) import com.octo.android.robospice.persistence.keysanitation.KeySanitizer;
74a5c4b2 robospice-cache-parent/robospice-cache/src/com/octo/android/robospice/persistence/file/InFileObjectPersisterFactory.java (Stéphane Nicolas 2012-12-17 16:39:07 +0100 15)
74a5c4b2 robospice-cache-parent/robospice-cache/src/com/octo/android/robospice/persistence/file/InFileObjectPersisterFactory.java (Stéphane Nicolas 2012-12-17 16:39:07 +0100 16) /**
d0c2991d robospice-cache-parent/robospice-cache/src/main/java/com/octo/android/robospice/persistence/file/InFileObjectPersisterFactory.java (Stéphane Nicolas 2013-06-01 19:15:50 +0200 17) * A factory that will create {@link ObjectPersister} instances that save/load
d0c2991d robospice-cache-parent/robospice-cache/src/main/java/com/octo/android/robospice/persistence/file/InFileObjectPersisterFactory.java (Stéphane Nicolas 2013-06-01 19:15:50 +0200 18) * data in a file.
74a5c4b2 robospice-cache-parent/robospice-cache/src/com/octo/android/robospice/persistence/file/InFileObjectPersisterFactory.java (Stéphane Nicolas 2012-12-17 16:39:07 +0100 19) * @author sni
74a5c4b2 robospice-cache-parent/robospice-cache/src/com/octo/android/robospice/persistence/file/InFileObjectPersisterFactory.java (Stéphane Nicolas 2012-12-17 16:39:07 +0100 20) */
d0c2991d robospice-cache-parent/robospice-cache/src/main/java/com/octo/android/robospice/persistence/file/InFileObjectPersisterFactory.java (Stéphane Nicolas 2013-06-01 19:15:50 +0200 21) public abstract class InFileObjectPersisterFactory extends ObjectPersisterFactory implements CacheCleaner {
7e52667d robospice-cache-parent/robospice-cache/src/com/octo/android/robospice/persistence/file/InFileObjectPersisterFactory.java (Stéphane Nicolas 2013-01-04 15:55:47 +0100 22)
d0c2991d robospice-cache-parent/robospice-cache/src/main/java/com/octo/android/robospice/persistence/file/InFileObjectPersisterFactory.java (Stéphane Nicolas 2013-06-01 19:15:50 +0200 23) // ----------------------------------
d0c2991d robospice-cache-parent/robospice-cache/src/main/java/com/octo/android/robospice/persistence/file/InFileObjectPersisterFactory.java (Stéphane Nicolas 2013-06-01 19:15:50 +0200 24) // ATTRIBUTES
d0c2991d robospice-cache-parent/robospice-cache/src/main/java/com/octo/android/robospice/persistence/file/InFileObjectPersisterFactory.java (Stéphane Nicolas 2013-06-01 19:15:50 +0200 25) // ----------------------------------
d0c2991d robospice-cache-parent/robospice-cache/src/main/java/com/octo/android/robospice/persistence/file/InFileObjectPersisterFactory.java (Stéphane Nicolas 2013-06-01 19:15:50 +0200 26) private File cacheFolder;
d0c2991d robospice-cache-parent/robospice-cache/src/main/java/com/octo/android/robospice/persistence/file/InFileObjectPersisterFactory.java (Stéphane Nicolas 2013-06-01 19:15:50 +0200 27) private String cachePrefix;
d0c2991d robospice-cache-parent/robospice-cache/src/main/java/com/octo/android/robospice/persistence/file/InFileObjectPersisterFactory.java (Stéphane Nicolas 2013-06-01 19:15:50 +0200 28) private KeySanitizer keySanitizer;
d0c2991d robospice-cache-parent/robospice-cache/src/main/java/com/octo/android/robospice/persistence/file/InFileObjectPersisterFactory.java (Stéphane Nicolas 2013-06-01 19:15:50 +0200 29)
d0c2991d robospice-cache-parent/robospice-cache/src/main/java/com/octo/android/robospice/persistence/file/InFileObjectPersisterFactory.java (Stéphane Nicolas 2013-06-01 19:15:50 +0200 30) // ----------------------------------
d0c2991d robospice-cache-parent/robospice-cache/src/main/java/com/octo/android/robospice/persistence/file/InFileObjectPersisterFactory.java (Stéphane Nicolas 2013-06-01 19:15:50 +0200 31) // CONSTRUCTORS
d0c2991d robospice-cache-parent/robospice-cache/src/main/java/com/octo/android/robospice/persistence/file/InFileObjectPersisterFactory.java (Stéphane Nicolas 2013-06-01 19:15:50 +0200 32) // ----------------------------------
d0c2991d robospice-cache-parent/robospice-cache/src/main/java/com/octo/android/robospice/persistence/file/InFileObjectPersisterFactory.java (Stéphane Nicolas 2013-06-01 19:15:50 +0200 33)
d0c2991d robospice-cache-parent/robospice-cache/src/main/java/com/octo/android/robospice/persistence/file/InFileObjectPersisterFactory.java (Stéphane Nicolas 2013-06-01 19:15:50 +0200 34) public InFileObjectPersisterFactory(Application application) throws CacheCreationException {
d0c2991d robospice-cache-parent/robospice-cache/src/main/java/com/octo/android/robospice/persistence/file/InFileObjectPersisterFactory.java (Stéphane Nicolas 2013-06-01 19:15:50 +0200 35) this(application, null, null);
d0c2991d robospice-cache-parent/robospice-cache/src/main/java/com/octo/android/robospice/persistence/file/InFileObjectPersisterFactory.java (Stéphane Nicolas 2013-06-01 19:15:50 +0200 36) }
d0c2991d robospice-cache-parent/robospice-cache/src/main/java/com/octo/android/robospice/persistence/file/InFileObjectPersisterFactory.java (Stéphane Nicolas 2013-06-01 19:15:50 +0200 37)
d0c2991d robospice-cache-parent/robospice-cache/src/main/java/com/octo/android/robospice/persistence/file/InFileObjectPersisterFactory.java (Stéphane Nicolas 2013-06-01 19:15:50 +0200 38) public InFileObjectPersisterFactory(Application application, File cacheFolder) throws CacheCreationException {
d0c2991d robospice-cache-parent/robospice-cache/src/main/java/com/octo/android/robospice/persistence/file/InFileObjectPersisterFactory.java (Stéphane Nicolas 2013-06-01 19:15:50 +0200 39) this(application, null, cacheFolder);
f30d13d8 robospice-cache-parent/robospice-cache/src/com/octo/android/robospice/persistence/file/InFileObjectPersisterFactory.java (Stéphane Nicolas 2013-01-06 16:20:26 +0100 40) }
7e52667d robospice-cache-parent/robospice-cache/src/com/octo/android/robospice/persistence/file/InFileObjectPersisterFactory.java (Stéphane Nicolas 2013-01-04 15:55:47 +0100 41)
d0c2991d robospice-cache-parent/robospice-cache/src/main/java/com/octo/android/robospice/persistence/file/InFileObjectPersisterFactory.java (Stéphane Nicolas 2013-06-01 19:15:50 +0200 42) public InFileObjectPersisterFactory(Application application, List<Class<?>> listHandledClasses) throws CacheCreationException {
d0c2991d robospice-cache-parent/robospice-cache/src/main/java/com/octo/android/robospice/persistence/file/InFileObjectPersisterFactory.java (Stéphane Nicolas 2013-06-01 19:15:50 +0200 43) this(application, listHandledClasses, null);
d0c2991d robospice-cache-parent/robospice-cache/src/main/java/com/octo/android/robospice/persistence/file/InFileObjectPersisterFactory.java (Stéphane Nicolas 2013-06-01 19:15:50 +0200 44) }
d0c2991d robospice-cache-parent/robospice-cache/src/main/java/com/octo/android/robospice/persistence/file/InFileObjectPersisterFactory.java (Stéphane Nicolas 2013-06-01 19:15:50 +0200 45)
d0c2991d robospice-cache-parent/robospice-cache/src/main/java/com/octo/android/robospice/persistence/file/InFileObjectPersisterFactory.java (Stéphane Nicolas 2013-06-01 19:15:50 +0200 46) public InFileObjectPersisterFactory(Application application, List<Class<?>> listHandledClasses, File cacheFolder) throws CacheCreationException {
f30d13d8 robospice-cache-parent/robospice-cache/src/com/octo/android/robospice/persistence/file/InFileObjectPersisterFactory.java (Stéphane Nicolas 2013-01-06 16:20:26 +0100 47) super(application, listHandledClasses);
d0c2991d robospice-cache-parent/robospice-cache/src/main/java/com/octo/android/robospice/persistence/file/InFileObjectPersisterFactory.java (Stéphane Nicolas 2013-06-01 19:15:50 +0200 48) setCacheFolder(cacheFolder);
d0c2991d robospice-cache-parent/robospice-cache/src/main/java/com/octo/android/robospice/persistence/file/InFileObjectPersisterFactory.java (Stéphane Nicolas 2013-06-01 19:15:50 +0200 49) setCachePrefix(getClass().getSimpleName() + InFileObjectPersister.CACHE_PREFIX_END);
d0c2991d robospice-cache-parent/robospice-cache/src/main/java/com/octo/android/robospice/persistence/file/InFileObjectPersisterFactory.java (Stéphane Nicolas 2013-06-01 19:15:50 +0200 50) }
d0c2991d robospice-cache-parent/robospice-cache/src/main/java/com/octo/android/robospice/persistence/file/InFileObjectPersisterFactory.java (Stéphane Nicolas 2013-06-01 19:15:50 +0200 51)
d0c2991d robospice-cache-parent/robospice-cache/src/main/java/com/octo/android/robospice/persistence/file/InFileObjectPersisterFactory.java (Stéphane Nicolas 2013-06-01 19:15:50 +0200 52) // ----------------------------------
d0c2991d robospice-cache-parent/robospice-cache/src/main/java/com/octo/android/robospice/persistence/file/InFileObjectPersisterFactory.java (Stéphane Nicolas 2013-06-01 19:15:50 +0200 53) // API
d0c2991d robospice-cache-parent/robospice-cache/src/main/java/com/octo/android/robospice/persistence/file/InFileObjectPersisterFactory.java (Stéphane Nicolas 2013-06-01 19:15:50 +0200 54) // ----------------------------------
d0c2991d robospice-cache-parent/robospice-cache/src/main/java/com/octo/android/robospice/persistence/file/InFileObjectPersisterFactory.java (Stéphane Nicolas 2013-06-01 19:15:50 +0200 55)
d0c2991d robospice-cache-parent/robospice-cache/src/main/java/com/octo/android/robospice/persistence/file/InFileObjectPersisterFactory.java (Stéphane Nicolas 2013-06-01 19:15:50 +0200 56) /**
d0c2991d robospice-cache-parent/robospice-cache/src/main/java/com/octo/android/robospice/persistence/file/InFileObjectPersisterFactory.java (Stéphane Nicolas 2013-06-01 19:15:50 +0200 57) * Sets the folder used by object persisters of this factory.
d0c2991d robospice-cache-parent/robospice-cache/src/main/java/com/octo/android/robospice/persistence/file/InFileObjectPersisterFactory.java (Stéphane Nicolas 2013-06-01 19:15:50 +0200 58) * @param cacheFolder
d0c2991d robospice-cache-parent/robospice-cache/src/main/java/com/octo/android/robospice/persistence/file/InFileObjectPersisterFactory.java (Stéphane Nicolas 2013-06-01 19:15:50 +0200 59) * the new cache folder of this factory (and persisters it will
d0c2991d robospice-cache-parent/robospice-cache/src/main/java/com/octo/android/robospice/persistence/file/InFileObjectPersisterFactory.java (Stéphane Nicolas 2013-06-01 19:15:50 +0200 60) * create). Ca be null, it will then default to the sub folder
d0c2991d robospice-cache-parent/robospice-cache/src/main/java/com/octo/android/robospice/persistence/file/InFileObjectPersisterFactory.java (Stéphane Nicolas 2013-06-01 19:15:50 +0200 61) * {@link InFileObjectPersister#DEFAULT_ROOT_CACHE_DIR} in side
d0c2991d robospice-cache-parent/robospice-cache/src/main/java/com/octo/android/robospice/persistence/file/InFileObjectPersisterFactory.java (Stéphane Nicolas 2013-06-01 19:15:50 +0200 62) * the application cache folder. Will be created if doesn't exist
d0c2991d robospice-cache-parent/robospice-cache/src/main/java/com/octo/android/robospice/persistence/file/InFileObjectPersisterFactory.java (Stéphane Nicolas 2013-06-01 19:15:50 +0200 63) * yet.
d0c2991d robospice-cache-parent/robospice-cache/src/main/java/com/octo/android/robospice/persistence/file/InFileObjectPersisterFactory.java (Stéphane Nicolas 2013-06-01 19:15:50 +0200 64) * @throws CacheCreationException
d0c2991d robospice-cache-parent/robospice-cache/src/main/java/com/octo/android/robospice/persistence/file/InFileObjectPersisterFactory.java (Stéphane Nicolas 2013-06-01 19:15:50 +0200 65) */
d0c2991d robospice-cache-parent/robospice-cache/src/main/java/com/octo/android/robospice/persistence/file/InFileObjectPersisterFactory.java (Stéphane Nicolas 2013-06-01 19:15:50 +0200 66) public void setCacheFolder(File cacheFolder) throws CacheCreationException {
d0c2991d robospice-cache-parent/robospice-cache/src/main/java/com/octo/android/robospice/persistence/file/InFileObjectPersisterFactory.java (Stéphane Nicolas 2013-06-01 19:15:50 +0200 67) if (cacheFolder == null) {
d0c2991d robospice-cache-parent/robospice-cache/src/main/java/com/octo/android/robospice/persistence/file/InFileObjectPersisterFactory.java (Stéphane Nicolas 2013-06-01 19:15:50 +0200 68) cacheFolder = new File(getApplication().getCacheDir(), InFileObjectPersister.DEFAULT_ROOT_CACHE_DIR);
d0c2991d robospice-cache-parent/robospice-cache/src/main/java/com/octo/android/robospice/persistence/file/InFileObjectPersisterFactory.java (Stéphane Nicolas 2013-06-01 19:15:50 +0200 69) }
d0c2991d robospice-cache-parent/robospice-cache/src/main/java/com/octo/android/robospice/persistence/file/InFileObjectPersisterFactory.java (Stéphane Nicolas 2013-06-01 19:15:50 +0200 70)
d0c2991d robospice-cache-parent/robospice-cache/src/main/java/com/octo/android/robospice/persistence/file/InFileObjectPersisterFactory.java (Stéphane Nicolas 2013-06-01 19:15:50 +0200 71) this.cacheFolder = cacheFolder;
d0c2991d robospice-cache-parent/robospice-cache/src/main/java/com/octo/android/robospice/persistence/file/InFileObjectPersisterFactory.java (Stéphane Nicolas 2013-06-01 19:15:50 +0200 72) if (!cacheFolder.exists() && !cacheFolder.mkdirs()) {
d0c2991d robospice-cache-parent/robospice-cache/src/main/java/com/octo/android/robospice/persistence/file/InFileObjectPersisterFactory.java (Stéphane Nicolas 2013-06-01 19:15:50 +0200 73) throw new CacheCreationException("The cache folder " + cacheFolder.getAbsolutePath() + " could not be created.");
d0c2991d robospice-cache-parent/robospice-cache/src/main/java/com/octo/android/robospice/persistence/file/InFileObjectPersisterFactory.java (Stéphane Nicolas 2013-06-01 19:15:50 +0200 74) }
d0c2991d robospice-cache-parent/robospice-cache/src/main/java/com/octo/android/robospice/persistence/file/InFileObjectPersisterFactory.java (Stéphane Nicolas 2013-06-01 19:15:50 +0200 75) }
d0c2991d robospice-cache-parent/robospice-cache/src/main/java/com/octo/android/robospice/persistence/file/InFileObjectPersisterFactory.java (Stéphane Nicolas 2013-06-01 19:15:50 +0200 76)
d0c2991d robospice-cache-parent/robospice-cache/src/main/java/com/octo/android/robospice/persistence/file/InFileObjectPersisterFactory.java (Stéphane Nicolas 2013-06-01 19:15:50 +0200 77) /**
d0c2991d robospice-cache-parent/robospice-cache/src/main/java/com/octo/android/robospice/persistence/file/InFileObjectPersisterFactory.java (Stéphane Nicolas 2013-06-01 19:15:50 +0200 78) * Sets the cachePrefix used by object persisters of this factory.
d0c2991d robospice-cache-parent/robospice-cache/src/main/java/com/octo/android/robospice/persistence/file/InFileObjectPersisterFactory.java (Stéphane Nicolas 2013-06-01 19:15:50 +0200 79) * @param cachePrefix
d0c2991d robospice-cache-parent/robospice-cache/src/main/java/com/octo/android/robospice/persistence/file/InFileObjectPersisterFactory.java (Stéphane Nicolas 2013-06-01 19:15:50 +0200 80) * the new cache cachePrefix of this factory (and persisters it
d0c2991d robospice-cache-parent/robospice-cache/src/main/java/com/octo/android/robospice/persistence/file/InFileObjectPersisterFactory.java (Stéphane Nicolas 2013-06-01 19:15:50 +0200 81) * will create). Defaults to "className".
d0c2991d robospice-cache-parent/robospice-cache/src/main/java/com/octo/android/robospice/persistence/file/InFileObjectPersisterFactory.java (Stéphane Nicolas 2013-06-01 19:15:50 +0200 82) */
d0c2991d robospice-cache-parent/robospice-cache/src/main/java/com/octo/android/robospice/persistence/file/InFileObjectPersisterFactory.java (Stéphane Nicolas 2013-06-01 19:15:50 +0200 83) public void setCachePrefix(String cachePrefix) {
d0c2991d robospice-cache-parent/robospice-cache/src/main/java/com/octo/android/robospice/persistence/file/InFileObjectPersisterFactory.java (Stéphane Nicolas 2013-06-01 19:15:50 +0200 84) this.cachePrefix = cachePrefix;
d0c2991d robospice-cache-parent/robospice-cache/src/main/java/com/octo/android/robospice/persistence/file/InFileObjectPersisterFactory.java (Stéphane Nicolas 2013-06-01 19:15:50 +0200 85) }
d0c2991d robospice-cache-parent/robospice-cache/src/main/java/com/octo/android/robospice/persistence/file/InFileObjectPersisterFactory.java (Stéphane Nicolas 2013-06-01 19:15:50 +0200 86)
d0c2991d robospice-cache-parent/robospice-cache/src/main/java/com/octo/android/robospice/persistence/file/InFileObjectPersisterFactory.java (Stéphane Nicolas 2013-06-01 19:15:50 +0200 87) public File getCacheFolder() {
d0c2991d robospice-cache-parent/robospice-cache/src/main/java/com/octo/android/robospice/persistence/file/InFileObjectPersisterFactory.java (Stéphane Nicolas 2013-06-01 19:15:50 +0200 88) return cacheFolder;
d0c2991d robospice-cache-parent/robospice-cache/src/main/java/com/octo/android/robospice/persistence/file/InFileObjectPersisterFactory.java (Stéphane Nicolas 2013-06-01 19:15:50 +0200 89) }
d0c2991d robospice-cache-parent/robospice-cache/src/main/java/com/octo/android/robospice/persistence/file/InFileObjectPersisterFactory.java (Stéphane Nicolas 2013-06-01 19:15:50 +0200 90)
d0c2991d robospice-cache-parent/robospice-cache/src/main/java/com/octo/android/robospice/persistence/file/InFileObjectPersisterFactory.java (Stéphane Nicolas 2013-06-01 19:15:50 +0200 91) public String getCachePrefix() {
d0c2991d robospice-cache-parent/robospice-cache/src/main/java/com/octo/android/robospice/persistence/file/InFileObjectPersisterFactory.java (Stéphane Nicolas 2013-06-01 19:15:50 +0200 92) return cachePrefix;
d0c2991d robospice-cache-parent/robospice-cache/src/main/java/com/octo/android/robospice/persistence/file/InFileObjectPersisterFactory.java (Stéphane Nicolas 2013-06-01 19:15:50 +0200 93) }
d0c2991d robospice-cache-parent/robospice-cache/src/main/java/com/octo/android/robospice/persistence/file/InFileObjectPersisterFactory.java (Stéphane Nicolas 2013-06-01 19:15:50 +0200 94)
d0c2991d robospice-cache-parent/robospice-cache/src/main/java/com/octo/android/robospice/persistence/file/InFileObjectPersisterFactory.java (Stéphane Nicolas 2013-06-01 19:15:50 +0200 95) public KeySanitizer getKeySanitizer() {
d0c2991d robospice-cache-parent/robospice-cache/src/main/java/com/octo/android/robospice/persistence/file/InFileObjectPersisterFactory.java (Stéphane Nicolas 2013-06-01 19:15:50 +0200 96) return keySanitizer;
d0c2991d robospice-cache-parent/robospice-cache/src/main/java/com/octo/android/robospice/persistence/file/InFileObjectPersisterFactory.java (Stéphane Nicolas 2013-06-01 19:15:50 +0200 97) }
d0c2991d robospice-cache-parent/robospice-cache/src/main/java/com/octo/android/robospice/persistence/file/InFileObjectPersisterFactory.java (Stéphane Nicolas 2013-06-01 19:15:50 +0200 98)
d0c2991d robospice-cache-parent/robospice-cache/src/main/java/com/octo/android/robospice/persistence/file/InFileObjectPersisterFactory.java (Stéphane Nicolas 2013-06-01 19:15:50 +0200 99) /**
d0c2991d robospice-cache-parent/robospice-cache/src/main/java/com/octo/android/robospice/persistence/file/InFileObjectPersisterFactory.java (Stéphane Nicolas 2013-06-01 19:15:50 +0200 100) * @param keySanitizer
d0c2991d robospice-cache-parent/robospice-cache/src/main/java/com/octo/android/robospice/persistence/file/InFileObjectPersisterFactory.java (Stéphane Nicolas 2013-06-01 19:15:50 +0200 101) * the new key sanitizer to be used by this
d0c2991d robospice-cache-parent/robospice-cache/src/main/java/com/octo/android/robospice/persistence/file/InFileObjectPersisterFactory.java (Stéphane Nicolas 2013-06-01 19:15:50 +0200 102) * {@link InFileObjectPersisterFactory} and persisters. May be
d0c2991d robospice-cache-parent/robospice-cache/src/main/java/com/octo/android/robospice/persistence/file/InFileObjectPersisterFactory.java (Stéphane Nicolas 2013-06-01 19:15:50 +0200 103) * null, in that case no key sanitation will be used. This is the
d0c2991d robospice-cache-parent/robospice-cache/src/main/java/com/octo/android/robospice/persistence/file/InFileObjectPersisterFactory.java (Stéphane Nicolas 2013-06-01 19:15:50 +0200 104) * default.
d0c2991d robospice-cache-parent/robospice-cache/src/main/java/com/octo/android/robospice/persistence/file/InFileObjectPersisterFactory.java (Stéphane Nicolas 2013-06-01 19:15:50 +0200 105) */
d0c2991d robospice-cache-parent/robospice-cache/src/main/java/com/octo/android/robospice/persistence/file/InFileObjectPersisterFactory.java (Stéphane Nicolas 2013-06-01 19:15:50 +0200 106) public void setKeySanitizer(KeySanitizer keySanitizer) {
d0c2991d robospice-cache-parent/robospice-cache/src/main/java/com/octo/android/robospice/persistence/file/InFileObjectPersisterFactory.java (Stéphane Nicolas 2013-06-01 19:15:50 +0200 107) this.keySanitizer = keySanitizer;
f30d13d8 robospice-cache-parent/robospice-cache/src/com/octo/android/robospice/persistence/file/InFileObjectPersisterFactory.java (Stéphane Nicolas 2013-01-06 16:20:26 +0100 108) }
7e52667d robospice-cache-parent/robospice-cache/src/com/octo/android/robospice/persistence/file/InFileObjectPersisterFactory.java (Stéphane Nicolas 2013-01-04 15:55:47 +0100 109)
f30d13d8 robospice-cache-parent/robospice-cache/src/com/octo/android/robospice/persistence/file/InFileObjectPersisterFactory.java (Stéphane Nicolas 2013-01-06 16:20:26 +0100 110) @Override
d0c2991d robospice-cache-parent/robospice-cache/src/main/java/com/octo/android/robospice/persistence/file/InFileObjectPersisterFactory.java (Stéphane Nicolas 2013-06-01 19:15:50 +0200 111) public final <T> InFileObjectPersister<T> createObjectPersister(Class<T> clazz) {
d0c2991d robospice-cache-parent/robospice-cache/src/main/java/com/octo/android/robospice/persistence/file/InFileObjectPersisterFactory.java (Stéphane Nicolas 2013-06-01 19:15:50 +0200 112)
d0c2991d robospice-cache-parent/robospice-cache/src/main/java/com/octo/android/robospice/persistence/file/InFileObjectPersisterFactory.java (Stéphane Nicolas 2013-06-01 19:15:50 +0200 113) InFileObjectPersister<T> inFileObjectPersister;
d0c2991d robospice-cache-parent/robospice-cache/src/main/java/com/octo/android/robospice/persistence/file/InFileObjectPersisterFactory.java (Stéphane Nicolas 2013-06-01 19:15:50 +0200 114) try {
d0c2991d robospice-cache-parent/robospice-cache/src/main/java/com/octo/android/robospice/persistence/file/InFileObjectPersisterFactory.java (Stéphane Nicolas 2013-06-01 19:15:50 +0200 115) inFileObjectPersister = createInFileObjectPersister(clazz, cacheFolder);
d0c2991d robospice-cache-parent/robospice-cache/src/main/java/com/octo/android/robospice/persistence/file/InFileObjectPersisterFactory.java (Stéphane Nicolas 2013-06-01 19:15:50 +0200 116) inFileObjectPersister.setFactoryCachePrefix(cachePrefix);
d0c2991d robospice-cache-parent/robospice-cache/src/main/java/com/octo/android/robospice/persistence/file/InFileObjectPersisterFactory.java (Stéphane Nicolas 2013-06-01 19:15:50 +0200 117) inFileObjectPersister.setKeySanitizer(keySanitizer);
d0c2991d robospice-cache-parent/robospice-cache/src/main/java/com/octo/android/robospice/persistence/file/InFileObjectPersisterFactory.java (Stéphane Nicolas 2013-06-01 19:15:50 +0200 118) return inFileObjectPersister;
d0c2991d robospice-cache-parent/robospice-cache/src/main/java/com/octo/android/robospice/persistence/file/InFileObjectPersisterFactory.java (Stéphane Nicolas 2013-06-01 19:15:50 +0200 119) } catch (CacheCreationException e) {
d0c2991d robospice-cache-parent/robospice-cache/src/main/java/com/octo/android/robospice/persistence/file/InFileObjectPersisterFactory.java (Stéphane Nicolas 2013-06-01 19:15:50 +0200 120) throw new RuntimeException("Could not create cache folder of factory.", e);
d0c2991d robospice-cache-parent/robospice-cache/src/main/java/com/octo/android/robospice/persistence/file/InFileObjectPersisterFactory.java (Stéphane Nicolas 2013-06-01 19:15:50 +0200 121) }
d0c2991d robospice-cache-parent/robospice-cache/src/main/java/com/octo/android/robospice/persistence/file/InFileObjectPersisterFactory.java (Stéphane Nicolas 2013-06-01 19:15:50 +0200 122) }
d0c2991d robospice-cache-parent/robospice-cache/src/main/java/com/octo/android/robospice/persistence/file/InFileObjectPersisterFactory.java (Stéphane Nicolas 2013-06-01 19:15:50 +0200 123)
d0c2991d robospice-cache-parent/robospice-cache/src/main/java/com/octo/android/robospice/persistence/file/InFileObjectPersisterFactory.java (Stéphane Nicolas 2013-06-01 19:15:50 +0200 124) public abstract <T> InFileObjectPersister<T> createInFileObjectPersister(Class<T> clazz, File cacheFolder) throws CacheCreationException;
d0c2991d robospice-cache-parent/robospice-cache/src/main/java/com/octo/android/robospice/persistence/file/InFileObjectPersisterFactory.java (Stéphane Nicolas 2013-06-01 19:15:50 +0200 125)
d0c2991d robospice-cache-parent/robospice-cache/src/main/java/com/octo/android/robospice/persistence/file/InFileObjectPersisterFactory.java (Stéphane Nicolas 2013-06-01 19:15:50 +0200 126) @Override
d0c2991d robospice-cache-parent/robospice-cache/src/main/java/com/octo/android/robospice/persistence/file/InFileObjectPersisterFactory.java (Stéphane Nicolas 2013-06-01 19:15:50 +0200 127) public void removeAllDataFromCache() {
d0c2991d robospice-cache-parent/robospice-cache/src/main/java/com/octo/android/robospice/persistence/file/InFileObjectPersisterFactory.java (Stéphane Nicolas 2013-06-01 19:15:50 +0200 128) File cacheFolder = getCacheFolder();
d0c2991d robospice-cache-parent/robospice-cache/src/main/java/com/octo/android/robospice/persistence/file/InFileObjectPersisterFactory.java (Stéphane Nicolas 2013-06-01 19:15:50 +0200 129) File[] cacheFileList = cacheFolder.listFiles(new FileFilter() {
d0c2991d robospice-cache-parent/robospice-cache/src/main/java/com/octo/android/robospice/persistence/file/InFileObjectPersisterFactory.java (Stéphane Nicolas 2013-06-01 19:15:50 +0200 130)
d0c2991d robospice-cache-parent/robospice-cache/src/main/java/com/octo/android/robospice/persistence/file/InFileObjectPersisterFactory.java (Stéphane Nicolas 2013-06-01 19:15:50 +0200 131) @Override
d0c2991d robospice-cache-parent/robospice-cache/src/main/java/com/octo/android/robospice/persistence/file/InFileObjectPersisterFactory.java (Stéphane Nicolas 2013-06-01 19:15:50 +0200 132) public boolean accept(File file) {
d0c2991d robospice-cache-parent/robospice-cache/src/main/java/com/octo/android/robospice/persistence/file/InFileObjectPersisterFactory.java (Stéphane Nicolas 2013-06-01 19:15:50 +0200 133) return file.getName().startsWith(getCachePrefix());
d0c2991d robospice-cache-parent/robospice-cache/src/main/java/com/octo/android/robospice/persistence/file/InFileObjectPersisterFactory.java (Stéphane Nicolas 2013-06-01 19:15:50 +0200 134) }
d0c2991d robospice-cache-parent/robospice-cache/src/main/java/com/octo/android/robospice/persistence/file/InFileObjectPersisterFactory.java (Stéphane Nicolas 2013-06-01 19:15:50 +0200 135) });
7e52667d robospice-cache-parent/robospice-cache/src/com/octo/android/robospice/persistence/file/InFileObjectPersisterFactory.java (Stéphane Nicolas 2013-01-04 15:55:47 +0100 136)
d0c2991d robospice-cache-parent/robospice-cache/src/main/java/com/octo/android/robospice/persistence/file/InFileObjectPersisterFactory.java (Stéphane Nicolas 2013-06-01 19:15:50 +0200 137) boolean allDeleted = true;
46760478 robospice-cache-parent/robospice-cache/src/main/java/com/octo/android/robospice/persistence/file/InFileObjectPersisterFactory.java (Stéphane Nicolas 2013-06-06 11:44:16 +0200 138) if (cacheFileList == null || cacheFileList.length == 0) {
46760478 robospice-cache-parent/robospice-cache/src/main/java/com/octo/android/robospice/persistence/file/InFileObjectPersisterFactory.java (Stéphane Nicolas 2013-06-06 11:44:16 +0200 139) return;
46760478 robospice-cache-parent/robospice-cache/src/main/java/com/octo/android/robospice/persistence/file/InFileObjectPersisterFactory.java (Stéphane Nicolas 2013-06-06 11:44:16 +0200 140) }
d0c2991d robospice-cache-parent/robospice-cache/src/main/java/com/octo/android/robospice/persistence/file/InFileObjectPersisterFactory.java (Stéphane Nicolas 2013-06-01 19:15:50 +0200 141) for (File cacheFile : cacheFileList) {
d0c2991d robospice-cache-parent/robospice-cache/src/main/java/com/octo/android/robospice/persistence/file/InFileObjectPersisterFactory.java (Stéphane Nicolas 2013-06-01 19:15:50 +0200 142) allDeleted = cacheFile.delete() && allDeleted;
d0c2991d robospice-cache-parent/robospice-cache/src/main/java/com/octo/android/robospice/persistence/file/InFileObjectPersisterFactory.java (Stéphane Nicolas 2013-06-01 19:15:50 +0200 143) }
d0c2991d robospice-cache-parent/robospice-cache/src/main/java/com/octo/android/robospice/persistence/file/InFileObjectPersisterFactory.java (Stéphane Nicolas 2013-06-01 19:15:50 +0200 144) if (allDeleted || cacheFileList.length == 0) {
d0c2991d robospice-cache-parent/robospice-cache/src/main/java/com/octo/android/robospice/persistence/file/InFileObjectPersisterFactory.java (Stéphane Nicolas 2013-06-01 19:15:50 +0200 145) Ln.d("Some file could not be deleted from cache.");
d0c2991d robospice-cache-parent/robospice-cache/src/main/java/com/octo/android/robospice/persistence/file/InFileObjectPersisterFactory.java (Stéphane Nicolas 2013-06-01 19:15:50 +0200 146) }
f30d13d8 robospice-cache-parent/robospice-cache/src/com/octo/android/robospice/persistence/file/InFileObjectPersisterFactory.java (Stéphane Nicolas 2013-01-06 16:20:26 +0100 147) }
74a5c4b2 robospice-cache-parent/robospice-cache/src/com/octo/android/robospice/persistence/file/InFileObjectPersisterFactory.java (Stéphane Nicolas 2012-12-17 16:39:07 +0100 148)
74a5c4b2 robospice-cache-parent/robospice-cache/src/com/octo/android/robospice/persistence/file/InFileObjectPersisterFactory.java (Stéphane Nicolas 2012-12-17 16:39:07 +0100 149) }