本文整理汇总了Java中com.avos.avoscloud.AVFile.withAbsoluteLocalPath方法的典型用法代码示例。如果您正苦于以下问题:Java AVFile.withAbsoluteLocalPath方法的具体用法?Java AVFile.withAbsoluteLocalPath怎么用?Java AVFile.withAbsoluteLocalPath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.avos.avoscloud.AVFile
的用法示例。
在下文中一共展示了AVFile.withAbsoluteLocalPath方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: makeAvFileList
import com.avos.avoscloud.AVFile; //导入方法依赖的package包/类
public static List<AVFile> makeAvFileList(List<String> imagesPaths){
List<AVFile> avFiles = new ArrayList<>();
if (imagesPaths != null){
for (String imagesPath : imagesPaths) {
String imageType = getImageType(imagesPath);
if (imageType != null) {
AVFile avFile = null;
try {
avFile = AVFile.withAbsoluteLocalPath(getImageName(imageType), imagesPath);
avFile.getThumbnailUrl(true,100,100);
avFiles.add(avFile);
} catch (FileNotFoundException e) {
NLog.i(TagUtil.makeTag(FileStorageHelper.class),e);
}
}
}
}
return avFiles;
}
示例2: uploadImages
import com.avos.avoscloud.AVFile; //导入方法依赖的package包/类
public List<ImageInfo> uploadImages (final List<String> imagesPaths){
if (imagesPaths != null) {
List<ImageInfo> imageInfos = new ArrayList<>();
for (String imagesPath : imagesPaths) {
String imageType = getImageType(imagesPath);
if (imageType != null){
try {
AVFile avFile = AVFile.withAbsoluteLocalPath(getImageName(imageType), imagesPath);
AvObjectSaveHelper.runSaveFileSync(avFile);
ImageInfo imageInfo = new ImageInfo();
imageInfo.setThumbnailUrl(avFile.getThumbnailUrl(true,100,100));
imageInfo.setBigImageUrl(avFile.getUrl());
imageInfos.add(imageInfo);
}catch (Exception e){
NLog.e(TagUtil.makeTag(FileStorageHelper.class),e);
}
}
}
return imageInfos;
}
return null;
}
示例3: onCrash
import com.avos.avoscloud.AVFile; //导入方法依赖的package包/类
@Override
public void onCrash(File file) {
if (file != null && !Config.isDebugMode) {
//接下来要在此处加入将闪退日志回传到服务器的功能
try {
AVFile avFile = AVFile.withAbsoluteLocalPath(file.getName(), file.getAbsolutePath());
avFile.saveInBackground();
// AVObject crash = new AVObject("Crash");
// crash.put("user_tel", MyApplication.user);
// crash.put("crash_log", avFile);
// crash.saveInBackground();
} catch (FileNotFoundException e) {
e.printStackTrace();
}
}
}
示例4: saveUserIcon
import com.avos.avoscloud.AVFile; //导入方法依赖的package包/类
/**
* 保存文件
*
* @param path
* @return
* @throws AVException
* @throws FileNotFoundException
*/
public static String saveUserIcon(String path) throws AVException, FileNotFoundException {
String mUser = PreferenceUtils.getString(Config.KEY_USER, "", MyApplication.context);
AVFile file = AVFile.withAbsoluteLocalPath(mUser + ".jpg", path);
file.save();
AVQuery<AVObject> query = new AVQuery<>("mUser");
query.whereEqualTo("user_tel", mUser);
AVObject user = query.getFirst();
user.put("user_icon", file.getObjectId());
user.save();
return file.getObjectId();
}
示例5: saveUserIconById
import com.avos.avoscloud.AVFile; //导入方法依赖的package包/类
/**
* 通过id保存用户icon
*
* @param path
* @return
* @throws AVException
* @throws FileNotFoundException
*/
public static String saveUserIconById(String path) throws AVException, FileNotFoundException {
String mUser = PreferenceUtils.getString(Config.KEY_USER, "", MyApplication.context);
AVFile file = AVFile.withObjectId(PreferenceUtils.getString(Config.KEY_USERICON, "", MyApplication.context));
file.delete();
AVFile newFile = AVFile.withAbsoluteLocalPath(mUser + ".jpg", path);
newFile.save();
AVQuery<AVObject> query = new AVQuery<>("mUser");
query.whereEqualTo("user_tel", mUser);
AVObject user = query.getFirst();
user.put("user_icon", newFile.getObjectId());
user.save();
return newFile.getObjectId();
}
示例6: upload
import com.avos.avoscloud.AVFile; //导入方法依赖的package包/类
public void upload() throws IOException, AVException {
if (msg.getType() != Msg.Type.Audio && msg.getType() != Msg.Type.Image) {
return;
}
String objectId = msg.getObjectId();
if (objectId == null) {
throw new NullPointerException("objectId mustn't be null");
}
String filePath = PathUtils.getChatFilePath(objectId);
AVFile file = AVFile.withAbsoluteLocalPath(objectId, filePath);
file.save();
String url = file.getUrl();
msg.setContent(url);
}