9
9
import java .util .UUID ;
10
10
11
11
import org .apache .SNX .util .JACodecUtil ;
12
- import org .apache .commons .io .IOUtils ;
13
12
import org .apache .commons .logging .Log ;
14
13
import org .apache .commons .logging .LogFactory ;
15
14
@@ -43,7 +42,7 @@ protected int getKeyPosition(String prefixPlusKey) {
43
42
44
43
public List <String > find (String prefix ) throws Throwable {
45
44
Iterable <Result <Item >> iter = _mclient .listObjects (_bucket , prefix , true );
46
-
45
+
47
46
List <String > lst = new ArrayList ();
48
47
for (Result <Item > result : iter ) {
49
48
Item item = result .get ();
@@ -70,7 +69,7 @@ public void put(String prefix, InputStream ins) throws Throwable {
70
69
key = key .replaceAll ("[^a-zA-Z0-9]" , "" );// clean
71
70
_mclient .putObject (_bucket , prefix + "/" + key , ins , "application/octet-stream" );
72
71
}
73
-
72
+
74
73
/**
75
74
* Auto generates guid, you only pass the prefix
76
75
*/
@@ -91,9 +90,9 @@ public void remove(String prefixPlusKey) throws Throwable {
91
90
*/
92
91
public Map getAsMap (String prefixPlusKey ) throws Throwable {
93
92
InputStream is = _mclient .getObject (_bucket , prefixPlusKey );
94
- byte [] array = IOUtils . toByteArray ( is );
93
+ byte [] array = is . readAllBytes ( );
95
94
InputStream ins = new ByteArrayInputStream (array );
96
-
95
+
97
96
String s = JACodecUtil .toStr (ins );
98
97
return JACodecUtil .toMap (s );
99
98
}
@@ -104,19 +103,18 @@ public Map getAsMap(String prefixPlusKey) throws Throwable {
104
103
*/
105
104
public List <Map <String , Object >> getAsList (String prefixPlusKey ) throws Throwable {
106
105
InputStream is = _mclient .getObject (_bucket , prefixPlusKey );
107
- byte [] array = IOUtils . toByteArray ( is );
106
+ byte [] array = is . readAllBytes ( );
108
107
InputStream ins = new ByteArrayInputStream (array );
109
-
108
+
110
109
String s = JACodecUtil .toStr (ins );
111
110
return JACodecUtil .toList (s );
112
111
}
113
112
114
113
public InputStream get (String prefixPlusKey ) throws Throwable {
115
114
InputStream is = _mclient .getObject (_bucket , prefixPlusKey );
116
- byte [] array = IOUtils . toByteArray ( is );
115
+ byte [] array = is . readAllBytes ( );
117
116
InputStream ins = new ByteArrayInputStream (array );
118
117
return ins ;
119
118
}
120
119
121
-
122
120
}// class
0 commit comments