mirror of https://github.com/apache/jclouds.git
added test for range requests with filesystem backend and corrected behavior
This commit is contained in:
parent
5843d5fee9
commit
173592f7d5
|
@ -567,7 +567,7 @@ public class FilesystemAsyncBlobStore extends BaseAsyncBlobStore {
|
|||
String[] firstLast = s.split("\\-");
|
||||
int offset = Integer.parseInt(firstLast[0]);
|
||||
int last = Integer.parseInt(firstLast[1]);
|
||||
int length = (last < data.length) ? last + 1 : data.length - offset;
|
||||
int length = last - offset + 1; // the range end is included
|
||||
out.write(data, offset, length);
|
||||
} else {
|
||||
return immediateFailedFuture(new IllegalArgumentException("first and last were null!"));
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -55,6 +55,9 @@ public class GetOptions {
|
|||
|
||||
/**
|
||||
* download the specified range of the object.
|
||||
* @param start first offset included in the response
|
||||
* @param end last offset included in the response (inclusive).
|
||||
* @return itself to enable daisy-chaining of expressions
|
||||
*/
|
||||
public GetOptions range(long start, long end) {
|
||||
checkArgument(start >= 0, "start must be >= 0");
|
||||
|
|
Loading…
Reference in New Issue