/** * Retrieve a AVFile object by object id from AVOSCloud.If the file is not found,it will throw * java.io.FileNotFoundException. * * @param objectId * @return * @throws AVException ,FileNotFoundException * @since 2.0.2 */ public static AVFile withObjectId(String objectId) throws AVException, FileNotFoundException { AVQuery<AVObject> query = new AVQuery<AVObject>("_File"); AVObject object = query.get(objectId); if (object != null && !AVUtils.isBlankString(object.getObjectId())) { AVFile file = createFileFromAVObject(object); return file; } else { throw new FileNotFoundException("Could not find file object by id:" + objectId); } }
/** * Retrieve a AVFile object by object id from AVOSCloud.If the file is not found,it will throw * java.io.FileNotFoundException. * * @param objectId objectId in _File table * @return AVFile AVFile instance * @throws AVException excpetion if _File table object failed to transfer to AVFile object * @throws FileNotFoundException exception if objectId is not invalid * @since 2.0.2 */ public static AVFile withObjectId(String objectId) throws AVException, FileNotFoundException { AVQuery<AVObject> query = new AVQuery<AVObject>("_File"); AVObject object = query.get(objectId); if (object != null && !AVUtils.isBlankString(object.getObjectId())) { AVFile file = createFileFromAVObject(object); return file; } else { throw new FileNotFoundException("Could not find file object by id:" + objectId); } }