Codota Logo
InFileInputStreamObjectPersister
Code IndexAdd Codota to your IDE (free)

How to use
InFileInputStreamObjectPersister
in
com.octo.android.robospice.persistence.binary

Best Java code snippets using com.octo.android.robospice.persistence.binary.InFileInputStreamObjectPersister (Showing top 3 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
StringBuilder s =
  • Codota Iconnew StringBuilder()
  • Codota Iconnew StringBuilder(32)
  • Codota IconString str;new StringBuilder(str)
  • Smart code suggestions by Codota
}
origin: com.octo.android.robospice/robospice-cache

@Override
public InputStream saveDataToCacheAndReturnData(InputStream data, final Object cacheKey) throws CacheSavingException {
  // special case for inputstream object : as it can be read only
  // once,
  // 0) we extract the content of the input stream as a byte[]
  // 1) we save it in file asynchronously if enabled
  // 2) the result will be a new InputStream on the byte[]
  final byte[] byteArray;
  try {
    byteArray = IOUtils.toByteArray(data);
    if (isAsyncSaveEnabled()) {
      Thread t = new Thread() {
        @Override
        public void run() {
          try {
            FileUtils.writeByteArrayToFile(getCacheFile(cacheKey), byteArray);
          } catch (IOException e) {
            Ln.e(e, "An error occured on saving request " + cacheKey + " data asynchronously");
          }
        };
      };
      t.start();
    } else {
      FileUtils.writeByteArrayToFile(getCacheFile(cacheKey), byteArray);
    }
    return new ByteArrayInputStream(byteArray);
  } catch (IOException e) {
    throw new CacheSavingException(e);
  }
}
origin: com.octo.android.robospice/robospice-sample

@Override
public CacheManager createCacheManager(Application application) {
  CacheManager cacheManager = new CacheManager();
  // init
  InFileStringObjectPersister inFileStringObjectPersister = new InFileStringObjectPersister(application);
  InFileInputStreamObjectPersister inFileInputStreamObjectPersister = new InFileInputStreamObjectPersister(application);
  JacksonObjectPersisterFactory inJSonFileObjectPersisterFactory = new JacksonObjectPersisterFactory(application);
  inFileStringObjectPersister.setAsyncSaveEnabled(true);
  inFileInputStreamObjectPersister.setAsyncSaveEnabled(true);
  inJSonFileObjectPersisterFactory.setAsyncSaveEnabled(true);
  cacheManager.addPersister(inFileStringObjectPersister);
  cacheManager.addPersister(inFileInputStreamObjectPersister);
  cacheManager.addPersister(inJSonFileObjectPersisterFactory);
  return cacheManager;
}
origin: com.octo.android.robospice/robospice-cache

  @Override
  public void run() {
    try {
      FileUtils.writeByteArrayToFile(getCacheFile(cacheKey), byteArray);
    } catch (IOException e) {
      Ln.e(e, "An error occured on saving request " + cacheKey + " data asynchronously");
    }
  };
};
com.octo.android.robospice.persistence.binaryInFileInputStreamObjectPersister

Most used methods

  • <init>
  • getCacheFile
  • isAsyncSaveEnabled
  • setAsyncSaveEnabled

Popular in Java

  • Reading from database using SQL prepared statement
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • setRequestProperty (URLConnection)
    Sets the general request property. If a property with the key already exists, overwrite its value wi
  • requestLocationUpdates (LocationManager)
  • Color (java.awt)
    The Color class is used encapsulate colors in the default sRGB color space or colors in arbitrary co
  • LinkedHashMap (java.util)
    Hash table and linked list implementation of the Map interface, with predictable iteration order. Th
  • Properties (java.util)
    The Properties class represents a persistent set of properties. The Properties can be saved to a st
  • Vector (java.util)
    The Vector class implements a growable array of objects. Like an array, it contains components that
  • ExecutorService (java.util.concurrent)
    An Executor that provides methods to manage termination and methods that can produce a Future for tr
  • Handler (java.util.logging)
    A Handler object accepts a logging request and exports the desired messages to a target, for example
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now