1
0
mirror of https://github.com/Rogiel/httpchannel synced 2025-12-06 07:32:50 +00:00

Implements SeekableDownloadChannel

The SeekableDownloadChannel implements SeekableByteChannel and allows to
set the position of the channel and read data from that point onward.
The SeekableDownloadChannel implementation, creates a new internal
DownloadChannel at every call to position(long), that will create a
resume channel onto that point, thus, not all service implementations
are supported.
This commit is contained in:
2012-01-17 23:11:03 -02:00
parent ff4abca387
commit a4c569f10e
29 changed files with 581 additions and 61 deletions

View File

@@ -32,6 +32,7 @@ import com.rogiel.httpchannel.service.CapabilityMatrix;
import com.rogiel.httpchannel.service.Credential;
import com.rogiel.httpchannel.service.Service;
import com.rogiel.httpchannel.service.ServiceID;
import com.rogiel.httpchannel.service.ServiceMode;
import com.rogiel.httpchannel.service.UploadChannel;
import com.rogiel.httpchannel.service.UploadService;
import com.rogiel.httpchannel.service.Uploader;
@@ -81,6 +82,12 @@ public class FileSonicService extends AbstractHttpService implements Service,
return 0;
}
@Override
public CapabilityMatrix<ServiceMode> getPossibleServiceModes() {
return new CapabilityMatrix<ServiceMode>(ServiceMode.UNAUTHENTICATED,
ServiceMode.NON_PREMIUM, ServiceMode.PREMIUM);
}
@Override
public Uploader<NullUploaderConfiguration> getUploader(String filename,
long filesize, NullUploaderConfiguration configuration) {
@@ -149,7 +156,7 @@ public class FileSonicService extends AbstractHttpService implements Service,
public UploaderImpl(String filename, long filesize,
NullUploaderConfiguration configuration) {
super(filename, filesize, configuration);
super(FileSonicService.this, filename, filesize, configuration);
}
@Override
@@ -186,6 +193,7 @@ public class FileSonicService extends AbstractHttpService implements Service,
public void login() throws IOException {
logger.debug("Logging to filesonic.com");
api.login(credential.getUsername(), credential.getPassword());
serviceMode = ServiceMode.NON_PREMIUM;
// if (username == null)
// throw new AuthenticationInvalidCredentialException();
}