@@ -58,15 +58,15 @@ public static CacheUtil get(File cacheDir) {
58
58
return get (cacheDir , MAX_SIZE , MAX_COUNT );
59
59
}
60
60
61
- public static CacheUtil get (Context ctx , long max_zise , int max_count ) {
61
+ public static CacheUtil get (Context ctx , long maxSise , int maxCount ) {
62
62
File f = new File (ctx .getCacheDir (), "ACache" );
63
- return get (f , max_zise , max_count );
63
+ return get (f , maxSise , maxCount );
64
64
}
65
65
66
- public static CacheUtil get (File cacheDir , long max_zise , int max_count ) {
66
+ public static CacheUtil get (File cacheDir , long maxZise , int maxCount ) {
67
67
CacheUtil manager = mInstanceMap .get (cacheDir .getAbsoluteFile () + myPid ());
68
68
if (manager == null ) {
69
- manager = new CacheUtil (cacheDir , max_zise , max_count );
69
+ manager = new CacheUtil (cacheDir , maxZise , maxCount );
70
70
mInstanceMap .put (cacheDir .getAbsolutePath () + myPid (), manager );
71
71
}
72
72
return manager ;
@@ -144,11 +144,11 @@ private static String myPid() {
144
144
return "_" + android .os .Process .myPid ();
145
145
}
146
146
147
- private CacheUtil (File cacheDir , long max_size , int max_count ) {
147
+ private CacheUtil (File cacheDir , long maxSize , int maxCount ) {
148
148
if (!cacheDir .exists () && !cacheDir .mkdirs ()) {
149
149
throw new RuntimeException ("can't make dirs in " + cacheDir .getAbsolutePath ());
150
150
}
151
- mCache = new ACacheManager (cacheDir , max_size , max_count );
151
+ mCache = new ACacheManager (cacheDir , maxSize , maxCount );
152
152
}
153
153
154
154
/**
@@ -290,9 +290,9 @@ public void put(String key, JSONObject value, int saveTime) {
290
290
* @return JSONObject数据
291
291
*/
292
292
public JSONObject getAsJSONObject (String key ) {
293
- String JSONString = getAsString (key );
293
+ String jsonString = getAsString (key );
294
294
try {
295
- JSONObject obj = new JSONObject (JSONString );
295
+ JSONObject obj = new JSONObject (jsonString );
296
296
return obj ;
297
297
} catch (Exception e ) {
298
298
return null ;
@@ -331,9 +331,9 @@ public void put(String key, JSONArray value, int saveTime) {
331
331
* @return JSONArray数据
332
332
*/
333
333
public JSONArray getAsJSONArray (String key ) {
334
- String JSONString = getAsString (key );
334
+ String jsonstring = getAsString (key );
335
335
try {
336
- JSONArray obj = new JSONArray (JSONString );
336
+ JSONArray obj = new JSONArray (jsonstring );
337
337
return obj ;
338
338
} catch (Exception e ) {
339
339
//e.printStackTrace();
@@ -413,15 +413,15 @@ public void put(String key, byte[] value, int saveTime) {
413
413
* @return byte 数据
414
414
*/
415
415
public byte [] getAsBinary (String key ) {
416
- RandomAccessFile RAFile = null ;
416
+ RandomAccessFile raFile = null ;
417
417
boolean removeFile = false ;
418
418
try {
419
419
File file = mCache .get (key );
420
420
if (!file .exists ())
421
421
return null ;
422
- RAFile = new RandomAccessFile (file , "r" );
423
- byte [] byteArray = new byte [(int ) RAFile .length ()];
424
- RAFile .read (byteArray );
422
+ raFile = new RandomAccessFile (file , "r" );
423
+ byte [] byteArray = new byte [(int ) raFile .length ()];
424
+ raFile .read (byteArray );
425
425
if (!Utils .isDue (byteArray )) {
426
426
return Utils .clearDateInfo (byteArray );
427
427
} else {
@@ -432,9 +432,9 @@ public byte[] getAsBinary(String key) {
432
432
e .printStackTrace ();
433
433
return null ;
434
434
} finally {
435
- if (RAFile != null ) {
435
+ if (raFile != null ) {
436
436
try {
437
- RAFile .close ();
437
+ raFile .close ();
438
438
} catch (IOException e ) {
439
439
e .printStackTrace ();
440
440
}
@@ -539,7 +539,7 @@ public Object getAsObject(String key) {
539
539
* @param value 保存的bitmap数据
540
540
*/
541
541
public void put (String key , Bitmap value ) {
542
- put (key , Utils .Bitmap2Bytes (value ));
542
+ put (key , Utils .bitmap2Bytes (value ));
543
543
}
544
544
545
545
/**
@@ -550,7 +550,7 @@ public void put(String key, Bitmap value) {
550
550
* @param saveTime 保存的时间,单位:秒
551
551
*/
552
552
public void put (String key , Bitmap value , int saveTime ) {
553
- put (key , Utils .Bitmap2Bytes (value ), saveTime );
553
+ put (key , Utils .bitmap2Bytes (value ), saveTime );
554
554
}
555
555
556
556
/**
@@ -563,7 +563,7 @@ public Bitmap getAsBitmap(String key) {
563
563
if (getAsBinary (key ) == null ) {
564
564
return null ;
565
565
}
566
- return Utils .Bytes2Bimap (getAsBinary (key ));
566
+ return Utils .bytes2Bimap (getAsBinary (key ));
567
567
}
568
568
569
569
// =======================================
@@ -601,7 +601,7 @@ public Drawable getAsDrawable(String key) {
601
601
if (getAsBinary (key ) == null ) {
602
602
return null ;
603
603
}
604
- return Utils .bitmap2Drawable (Utils .Bytes2Bimap (getAsBinary (key )));
604
+ return Utils .bitmap2Drawable (Utils .bytes2Bimap (getAsBinary (key )));
605
605
}
606
606
607
607
/**
@@ -881,7 +881,7 @@ private static String createDateInfo(int second) {
881
881
/*
882
882
* Bitmap → byte[]
883
883
*/
884
- private static byte [] Bitmap2Bytes (Bitmap bm ) {
884
+ private static byte [] bitmap2Bytes (Bitmap bm ) {
885
885
if (bm == null ) {
886
886
return null ;
887
887
}
@@ -893,7 +893,7 @@ private static byte[] Bitmap2Bytes(Bitmap bm) {
893
893
/*
894
894
* byte[] → Bitmap
895
895
*/
896
- private static Bitmap Bytes2Bimap (byte [] b ) {
896
+ private static Bitmap bytes2Bimap (byte [] b ) {
897
897
if (b .length == 0 ) {
898
898
return null ;
899
899
}
0 commit comments