use of com.octo.android.robospice.request.ProgressByteProcessor in project robospice by stephanenicolas.
the class OkHttpBigBinaryRequest method processStream.
@Override
public InputStream processStream(final int contentLength, final InputStream inputStream) throws IOException {
OutputStream fileOutputStream = null;
try {
// touch
boolean isTouchedNow = cacheFile.setLastModified(System.currentTimeMillis());
if (!isTouchedNow) {
Ln.d("Modification time of file %s could not be changed normally ", cacheFile.getAbsolutePath());
}
fileOutputStream = new FileOutputStream(cacheFile);
readBytes(inputStream, new ProgressByteProcessor(this, fileOutputStream, contentLength));
return new FileInputStream(cacheFile);
} finally {
IOUtils.closeQuietly(fileOutputStream);
}
}
use of com.octo.android.robospice.request.ProgressByteProcessor in project robospice by stephanenicolas.
the class OkHttpSmallBinaryRequest method processStream.
@Override
public InputStream processStream(final int contentLength, final InputStream inputStream) throws IOException {
final ByteArrayOutputStream bos = new ByteArrayOutputStream();
readBytes(inputStream, new ProgressByteProcessor(this, bos, contentLength));
final byte[] bytes = bos.toByteArray();
return new ByteArrayInputStream(bytes);
}
use of com.octo.android.robospice.request.ProgressByteProcessor in project robospice by stephanenicolas.
the class BitmapRequest method processStream.
public void processStream(int contentLength, final InputStream inputStream) throws IOException {
OutputStream fileOutputStream = null;
try {
// touch
boolean isTouchedNow = cacheFile.setLastModified(System.currentTimeMillis());
if (!isTouchedNow) {
Ln.d("Modification time of file %s could not be changed normally ", cacheFile.getAbsolutePath());
}
fileOutputStream = new FileOutputStream(cacheFile);
readBytes(inputStream, new ProgressByteProcessor(this, fileOutputStream, contentLength));
} finally {
IOUtils.closeQuietly(fileOutputStream);
}
}
use of com.octo.android.robospice.request.ProgressByteProcessor in project robospice by stephanenicolas.
the class OkHttpBitmapRequest method processStream.
public void processStream(int contentLength, final InputStream inputStream) throws IOException {
OutputStream fileOutputStream = null;
try {
// touch
boolean isTouchedNow = cacheFile.setLastModified(System.currentTimeMillis());
if (!isTouchedNow) {
Ln.d("Modification time of file %s could not be changed normally ", cacheFile.getAbsolutePath());
}
fileOutputStream = new FileOutputStream(cacheFile);
readBytes(inputStream, new ProgressByteProcessor(this, fileOutputStream, contentLength));
} finally {
IOUtils.closeQuietly(fileOutputStream);
}
}
use of com.octo.android.robospice.request.ProgressByteProcessor in project robospice by stephanenicolas.
the class BigBinaryRequest method processStream.
@Override
public InputStream processStream(final int contentLength, final InputStream inputStream) throws IOException {
OutputStream fileOutputStream = null;
try {
// touch
boolean isTouchedNow = cacheFile.setLastModified(System.currentTimeMillis());
if (!isTouchedNow) {
Ln.d("Modification time of file %s could not be changed normally ", cacheFile.getAbsolutePath());
}
fileOutputStream = new FileOutputStream(cacheFile);
readBytes(inputStream, new ProgressByteProcessor(this, fileOutputStream, contentLength));
return new FileInputStream(cacheFile);
} finally {
IOUtils.closeQuietly(fileOutputStream);
}
}
Aggregations