"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "httpclient-cache/src/main/java/org/apache/http/impl/client/cache/FileResourceFactory.java" between
httpcomponents-client-4.5.6-src.tar.gz and httpcomponents-client-4.5.7-src.tar.gz

About: HttpComponents is an Apache project responsible for creating and maintaining a toolset of low level Java components focused on HTTP and associated protocols. Java sources.

FileResourceFactory.java  (httpcomponents-client-4.5.6-src):FileResourceFactory.java  (httpcomponents-client-4.5.7-src)
skipping to change at line 76 skipping to change at line 76
} else { } else {
buffer.append('-'); buffer.append('-');
} }
} }
return new File(this.cacheDir, buffer.toString()); return new File(this.cacheDir, buffer.toString());
} }
@Override @Override
public Resource generate( public Resource generate(
final String requestId, final String requestId,
final InputStream instream, final InputStream inStream,
final InputLimit limit) throws IOException { final InputLimit limit) throws IOException {
final File file = generateUniqueCacheFile(requestId); final File file = generateUniqueCacheFile(requestId);
final FileOutputStream outstream = new FileOutputStream(file); final FileOutputStream outStream = new FileOutputStream(file);
try { try {
final byte[] buf = new byte[2048]; final byte[] buf = new byte[2048];
long total = 0; long total = 0;
int l; int l;
while ((l = instream.read(buf)) != -1) { while ((l = inStream.read(buf)) != -1) {
outstream.write(buf, 0, l); outStream.write(buf, 0, l);
total += l; total += l;
if (limit != null && total > limit.getValue()) { if (limit != null && total > limit.getValue()) {
limit.reached(); limit.reached();
break; break;
} }
} }
} finally { } finally {
outstream.close(); outStream.close();
} }
return new FileResource(file); return new FileResource(file);
} }
@Override @Override
public Resource copy( public Resource copy(
final String requestId, final String requestId,
final Resource resource) throws IOException { final Resource resource) throws IOException {
final File file = generateUniqueCacheFile(requestId); final File file = generateUniqueCacheFile(requestId);
 End of changes. 4 change blocks. 
5 lines changed or deleted 5 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)