Note that there are some explanatory texts on larger screens.

plurals
  1. POSimpleDiskCache inputStream bad number format
    text
    copied!<p>I'm using the SimpleDiskCache code (<a href="https://github.com/fhucho/simple-disk-cache" rel="nofollow">github link</a>) to cache a few video files to disk for an Android app I'm working. Here's how I put the video file to cache:</p> <pre><code>OutputStream fil = videoCache.openStream(newData.getObjectId().toLowerCase()); fil.write(videoInBytes); fil.flush(); fil.close(); </code></pre> <p>And here's the code where I want to retrieve the video file from cache:</p> <pre><code>InputStream in = videoCache.getInputStream(newData.getObjectId().toLowerCase()).getInputStream(); File videoFile = Utils.createFile(Utils.TYPE_VIDEO_FILE); OutputStream os = new FileOutputStream(videoFile); IOUtils.copy(in, os); os.close(); in.close(); </code></pre> <p>The only problem is that I get a IOExption: read failed: EBADF (Bad file number). Here's the stack trace:</p> <pre><code>06-29 18:47:21.422: W/System.err(19393): java.io.IOException: read failed: EBADF (Bad file number) 06-29 18:47:21.422: W/System.err(19393): at libcore.io.IoBridge.read(IoBridge.java:442) 06-29 18:47:21.430: W/System.err(19393): at java.io.FileInputStream.read(FileInputStream.java:179) 06-29 18:47:21.430: W/System.err(19393): at java.io.InputStream.read(InputStream.java:163) 06-29 18:47:21.430: W/System.err(19393): at com.google.api.client.util.ByteStreams.copy(ByteStreams.java:51) 06-29 18:47:21.430: W/System.err(19393): at com.google.api.client.util.IOUtils.copy(IOUtils.java:87) 06-29 18:47:21.430: W/System.err(19393): at com.google.api.client.util.IOUtils.copy(IOUtils.java:56) 06-29 18:47:21.430: W/System.err(19393): at com.licenta.mementoapp.datafragments.VideoFragment$1.done(VideoFragment.java:151) </code></pre> <p>Does anyone have any ideea what I'm doing wrong? Thanks!</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload