public class HTTPRemoteFile extends AbstractRemoteFile
Modifier and Type | Field and Description |
---|---|
protected String |
checksum
If useChecksums is true, contains the file checksum.
|
protected String |
hostname
The name of the host this file originated on.
|
static String |
HTTPREMOTEFILE_PORT_NUMBER
settings.common.remoteFile.port:
The setting for the HTTP remotefile port number used. |
protected URL |
url
The url that exposes this remote file.
|
file, fileDeletable, filesize, multipleDownloads, useChecksums
Modifier | Constructor and Description |
---|---|
protected |
HTTPRemoteFile(File file,
boolean useChecksums,
boolean fileDeletable,
boolean multipleDownloads)
Initialises a remote file implemented by point-to-point HTTP communication.
|
Modifier and Type | Method and Description |
---|---|
void |
cleanup()
Invalidate all file handles, by asking the remote registry to remove the url for this remote file from the list
of shared files.
|
void |
copyTo(File destFile)
Copy this remote file to the given file.
|
String |
getChecksum()
Get checksum for file, or null if checksums were not requested.
|
InputStream |
getInputStream()
Get an input stream representing the remote file.
|
static RemoteFile |
getInstance(File f,
Boolean useChecksums,
Boolean fileDeletable,
Boolean multipleDownloads)
Initialises a remote file implemented by point-to-point HTTP communication.
|
int |
getNumberOfRetries()
Retrieval of the number of retries for retrieving a file from a HTTP server.
|
protected HTTPRemoteFileRegistry |
getRegistry()
Get the webserver registry for this class of files.
|
protected boolean |
isLocal()
Helper method to determine if file resides on local machine.
|
appendTo, getName, getSize, toString
public static String HTTPREMOTEFILE_PORT_NUMBER
protected HTTPRemoteFile(File file, boolean useChecksums, boolean fileDeletable, boolean multipleDownloads)
file
- The file to make a remote file foruseChecksums
- Whether communications are checksummed. If true, getChecksum will also return the checksum.fileDeletable
- if true, the file given to this method is deletable, once it is transferred.multipleDownloads
- if true, the file may be transferred more than once. Otherwise, all file handles are
attempted to be made invalid after the first transfer, although no guarantees are made.ArgumentNotValid
- if file is null, or not a readable file.IOFailure
- if checksums are requested, but i/o errors occur while checksumming.public static RemoteFile getInstance(File f, Boolean useChecksums, Boolean fileDeletable, Boolean multipleDownloads)
f
- The file to make a remote file foruseChecksums
- Whether communications are checksummed. If true, getChecksum will also return the checksum.fileDeletable
- if true, the file given to this method is deletable, once it is transferred.multipleDownloads
- if true, the file may be transferred more than once. Otherwise, all file handles are
attempted to be made invalid after the first transfer, although no guarantees are made.ArgumentNotValid
- if file is null, or not a readable file.IOFailure
- if checksums are requested, but i/o errors occur while checksumming.protected HTTPRemoteFileRegistry getRegistry()
public void copyTo(File destFile)
copyTo
in interface RemoteFile
copyTo
in class AbstractRemoteFile
destFile
- The file to write the remote file to.ArgumentNotValid
- on null destFile, or parent to destfile is not a writeable directory, or destfile exists
and cannot be overwritten.IOFailure
- on I/O trouble writing remote file to destination.public InputStream getInputStream()
getInputStream
in interface RemoteFile
getInputStream
in class AbstractRemoteFile
IOFailure
- on I/O trouble generating inputstream for remote file. Also, the returned remote file will
throw IOFailure on close, if checksums are requested, but do not match.public void cleanup()
cleanup
in interface RemoteFile
cleanup
in class AbstractRemoteFile
public String getChecksum()
getChecksum
in interface RemoteFile
getChecksum
in class AbstractRemoteFile
protected boolean isLocal()
public int getNumberOfRetries()
getNumberOfRetries
in class AbstractRemoteFile
Copyright © 2005–2016 The Royal Danish Library, the Danish State and University Library, the National Library of France and the Austrian National Library.. All rights reserved.