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:
@@ -24,6 +24,7 @@ import com.rogiel.httpchannel.service.Downloader;
|
||||
import com.rogiel.httpchannel.service.DownloaderCapability;
|
||||
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;
|
||||
@@ -82,6 +83,12 @@ public class UploadHereService 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) {
|
||||
@@ -177,7 +184,7 @@ public class UploadHereService extends AbstractHttpService implements Service,
|
||||
|
||||
public UploaderImpl(String filename, long filesize,
|
||||
NullUploaderConfiguration configuration) {
|
||||
super(filename, filesize, configuration);
|
||||
super(UploadHereService.this, filename, filesize, configuration);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -223,7 +230,7 @@ public class UploadHereService extends AbstractHttpService implements Service,
|
||||
AbstractHttpDownloader<NullDownloaderConfiguration> implements
|
||||
Downloader<NullDownloaderConfiguration> {
|
||||
public DownloaderImpl(URI uri, NullDownloaderConfiguration configuration) {
|
||||
super(uri, configuration);
|
||||
super(UploadHereService.this, uri, configuration);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -288,6 +295,7 @@ public class UploadHereService extends AbstractHttpService implements Service,
|
||||
.parameter("password", credential.getPassword()).asPage();
|
||||
if (page.contains(INVALID_LOGIN_STRING))
|
||||
throw new AuthenticationInvalidCredentialException();
|
||||
serviceMode = ServiceMode.NON_PREMIUM;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user