本文整理汇总了Java中com.cloudinary.utils.ObjectUtils类的典型用法代码示例。如果您正苦于以下问题:Java ObjectUtils类的具体用法?Java ObjectUtils怎么用?Java ObjectUtils使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ObjectUtils类属于com.cloudinary.utils包,在下文中一共展示了ObjectUtils类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: upload
import com.cloudinary.utils.ObjectUtils; //导入依赖的package包/类
public void upload(File toUpload) throws IOException {
Thread thread = new Thread(new Runnable() {
@Override
public void run() {
try {
lastResult = cloudinary.uploader().upload(toUpload, ObjectUtils.emptyMap());
last_public_id = (String) lastResult.get("public_id");
} catch (IOException e) {
Platform.runLater(()->{
Notifications.create().title("Error").text("Network is unreachable").showError();
});
e.printStackTrace();
}
}
});
thread.run();
}
示例2: upload
import com.cloudinary.utils.ObjectUtils; //导入依赖的package包/类
@Override
public void upload(final File file, final String id, final ImageStorageFinishedListener listener) {
new AsyncTask<Void, Void, Void>() {
boolean success = false;
@Override
protected Void doInBackground(Void... voids) {
Map params = ObjectUtils.asMap("public_id", id);
try {
cloudinary.uploader().upload(file, params);
success = true;
} catch (Exception e) {
listener.onError(e.getMessage());
}
return null;
}
@Override
protected void onPostExecute(Void aVoid) {
if (success) {
listener.onSuccess();
}
}
}.execute();
}
示例3: doInBackground
import com.cloudinary.utils.ObjectUtils; //导入依赖的package包/类
@Override
protected String doInBackground(Void... params) {
try{
File file = new File(filePath);
String fileName = file.getName();
fileName = fileName.substring(0, fileName.lastIndexOf('.'));
Map cloudinaryResult = cloudinary.uploader().upload(file, ObjectUtils.asMap("public_id", "profile_img/"+fileName));
Log.d(TAG, cloudinaryResult.toString());
return (String) cloudinaryResult.get("secure_url");
} catch (IOException ioe) {
return "Error Uploading File " + ioe.toString();
} catch (RuntimeException run) {
return "Error Uploading File " + run.toString();
}
}
示例4: uploadPhotoToAlbum
import com.cloudinary.utils.ObjectUtils; //导入依赖的package包/类
@Override
public String uploadPhotoToAlbum(String albumHash, File photo) {
Map result;
String publicId = albumHash + cropSuffixIfAvailable(photo.getName(), ".png");
try {
result = mCloudinary.uploader().upload(new BufferedInputStream(new FileInputStream
(photo)), ObjectUtils.asMap("public_id", publicId));
} catch (IOException e) {
Log.e("HomeStuff", "Error uploading photo to cloudinary: " + e);
return null;
}
Log.d("HomeStuff", "Upload result: " + result);
if (result.containsKey("url")) {
return (String) result.get("url");
}
return null;
}
示例5: CloudHost
import com.cloudinary.utils.ObjectUtils; //导入依赖的package包/类
CloudHost() {
Map params = ObjectUtils.asMap(
"cloud_name", "dira4xawu",
"api_key", "596983916447626",
"api_secret", "H-23JcrsPFmkwy7yWHoH2R8DmD8"
);
cloudinary = new Cloudinary(params);
}
示例6: CloudinaryController
import com.cloudinary.utils.ObjectUtils; //导入依赖的package包/类
public CloudinaryController() {
// do not mess with api_secret boys and girls...
mCloudinary = new Cloudinary(ObjectUtils.asMap(
"cloud_name", "whatsthat",
"api_key", "573493652391299",
"api_secret", "9w7fbIr3pQOSb63QEg0vRBSACvw"));
}
示例7: upload
import com.cloudinary.utils.ObjectUtils; //导入依赖的package包/类
public String upload(String file) throws IOException {
Map uploadResult = cloudinary.uploader().upload(file, ObjectUtils.emptyMap());
url = (String) uploadResult.get("url");
return url;
}