congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
SaveCallback
Code IndexAdd Tabnine to your IDE (free)

How to use
SaveCallback
in
cn.leancloud.callback

Best Java code snippets using cn.leancloud.callback.SaveCallback (Showing top 6 results out of 315)

origin: cn.leancloud/storage-core

 protected final void internalDone0(T returnValue, AVException e) {
  done(e);
 }
}
origin: cn.leancloud/realtime-core

 @Override
 public void done(AVException e) {
  file.put(FILE_META, metaData);
  if (callback != null) {
   callback.internalDone(e);
  }
 }
});
origin: cn.leancloud/realtime-core

 @Override
 public void done(AVException e) {
  if (e != null) {
   callback.internalDone(e);
  } else {
   fulFillFileInfo(callback);
  }
 }
}));
origin: cn.leancloud/realtime-core

protected void upload(final SaveCallback callback) {
 if (actualFile != null) {
  actualFile.saveInBackground().subscribe(ObserverBuilder.buildSingleObserver(new SaveCallback() {
   @Override
   public void done(AVException e) {
    if (e != null) {
     callback.internalDone(e);
    } else {
     fulFillFileInfo(callback);
    }
   }
  }));
 } else {
  callback.internalDone(new AVException(new RuntimeException("cannot find the file!")));
 }
}
origin: cn.leancloud/realtime-core

protected void getAdditionalMetaData(Map<String, Object> meta, SaveCallback callback) {
 if (!this.hasAdditionalMetaAttr) {
  callback.internalDone(null);
 } else if (!StringUtil.isEmpty(actualFile.getUrl()) && localFile == null
      && !isExternalAVFile(actualFile)) {
  OkHttpClient client = PaasClient.getGlobalOkHttpClient();
  Request.Builder builder = new Request.Builder();
  try {
   Response rawResponse = client.newCall(builder.url(actualFile.getUrl() + getQueryName()).get().build()).execute();
   String content = rawResponse.body().string();
   com.alibaba.fastjson.JSONObject response = JSON.parseObject(content);
   com.alibaba.fastjson.JSONObject formatInfo = response.getJSONObject(FORMAT);
   parseAdditionalMetaData(meta, formatInfo);
   callback.internalDone(null);
  } catch (IOException ex) {
   callback.internalDone(new AVException(ex));
  } catch (Exception e1) {
   callback.internalDone(new AVException(e1));
  }
 } else {
  callback.internalDone(null);
 }
}
origin: cn.leancloud/realtime-core

protected void fulFillFileInfo(final SaveCallback callback) {
 // fulfill the file info map with AVFile
 if (actualFile != null) {
  file = getFile() == null ? new HashMap<String, Object>() : getFile();
  file.put(OBJECT_ID, actualFile.getObjectId());
  file.put(FILE_URL, actualFile.getUrl());
  file.remove(LOCAL_PATH);
  final Map<String, Object> metaData =
      getFileMetaData() == null ? new HashMap<String, Object>() : getFileMetaData();
  if (!metaData.containsKey(FILE_SIZE)) {
   metaData.put(FILE_SIZE, actualFile.getSize());
  }
  getAdditionalMetaData(metaData, new SaveCallback() {
   @Override
   public void done(AVException e) {
    file.put(FILE_META, metaData);
    if (callback != null) {
     callback.internalDone(e);
    }
   }
  });
 } else {
  callback.internalDone(new AVException(new RuntimeException("cannot find the file!")));
 }
}
cn.leancloud.callbackSaveCallback

Most used methods

  • done
    Override this function with the code you want to run after the save is complete.
  • internalDone

Popular in Java

  • Start an intent from android
  • startActivity (Activity)
  • runOnUiThread (Activity)
  • getExternalFilesDir (Context)
  • File (java.io)
    An "abstract" representation of a file system entity identified by a pathname. The pathname may be a
  • BigDecimal (java.math)
    An immutable arbitrary-precision signed decimal.A value is represented by an arbitrary-precision "un
  • URL (java.net)
    A Uniform Resource Locator that identifies the location of an Internet resource as specified by RFC
  • DateFormat (java.text)
    Formats or parses dates and times.This class provides factories for obtaining instances configured f
  • Collection (java.util)
    Collection is the root of the collection hierarchy. It defines operations on data collections and t
  • UUID (java.util)
    UUID is an immutable representation of a 128-bit universally unique identifier (UUID). There are mul
  • Top Vim plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now