class InputStreamWriter implements DiskCache.Writer {

	@Override
	public boolean write(File file) {
		FileOutputStream stream = null;
		FileLock lock = null;
		try {
			stream = new FileOutputStream(file);
			lock = stream.getChannel().lock();
			int bufferSize = 1024;
			byte[] buffer = new byte[bufferSize];
			int len = 0;
			while ((len = in.read(buffer)) != -1) {
				stream.write(buffer, 0, len);
			}
			return true;
		} catch (FileNotFoundException e) {
			return false;
		} catch (IOException e) {
			return false;
		} finally {
			if (lock != null) {
				try {
					lock.release();
				} catch (IOException e) {
					Log.w("InputStreamWriter", "Couldn't release lock");
				}
			}
			IOUtils.close(stream);
		}
	}

	public  InputStreamWriter(InputStream in);

}