@@ -131,18 +131,7 @@ public ICancel bput(String host, InputStreamAt input, String ctx, long blockOffs
131131 }
132132
133133 public ICancel mkfile (String key , long fsize , String mimeType , Map <String , String > params , String ctxs , CallRet ret ) {
134- String url = Conf .UP_HOST + "/mkfile/" + fsize ;
135- if (mimeType != null && mimeType .length () > 0 ) {
136- url += "/mimeType/" + Base64 .encode (mimeType );
137- }
138- if (key != null && key .length () > 0 ) {
139- url += "/key/" + Base64 .encode (key );
140- }
141- if (params != null && params .size () > 0 ) {
142- for (Map .Entry <String , String > a : params .entrySet ()) {
143- url += "/" + a .getKey () + "/" + Base64 .encode (a .getValue ());
144- }
145- }
134+ String url = Conf .UP_HOST + mkfilePath (key , fsize , mimeType , params );
146135 StringEntity entity = null ;
147136 try {
148137 entity = new StringEntity (ctxs );
@@ -153,4 +142,20 @@ public ICancel mkfile(String key, long fsize, String mimeType, Map<String, Strin
153142 }
154143 return call (makeClientExecutor (), url , entity , ret );
155144 }
145+
146+ private static String mkfilePath (String key , long fsize , String mimeType , Map <String , String > params ){
147+ String path = "/mkfile/" + fsize ;
148+ if (mimeType != null && mimeType .length () > 0 ) {
149+ path += "/mimeType/" + Base64 .encode (mimeType );
150+ }
151+ if (key != null && key .length () > 0 ) {
152+ path += "/key/" + Base64 .encode (key );
153+ }
154+ if (params != null && params .size () > 0 ) {
155+ for (Map .Entry <String , String > a : params .entrySet ()) {
156+ path += "/" + a .getKey () + "/" + Base64 .encode (a .getValue ());
157+ }
158+ }
159+ return path ;
160+ }
156161}
0 commit comments