public final class AgentFileResourceImpl extends java.lang.Object implements AgentFileStreamService.AgentFileResource
Resource
for files local to an agent running a job that can be
requested and streamed to the server (so they can be served via API).Modifier and Type | Method and Description |
---|---|
long |
contentLength() |
org.springframework.core.io.Resource |
createRelative(java.lang.String relativePath) |
boolean |
exists() |
static AgentFileStreamService.AgentFileResource |
forAgentFile(java.net.URI uri,
long size,
java.time.Instant lastModifiedTime,
java.nio.file.Path relativePath,
java.lang.String jobId,
java.io.InputStream inputStream)
Factory method to create a resource for a remote file.
|
static AgentFileResourceImpl |
forNonExistingResource()
Factory method to create a placeholder resource for a remote file that does not exist.
|
java.lang.String |
getDescription() |
java.io.File |
getFile() |
java.lang.String |
getFilename() |
java.io.InputStream |
getInputStream() |
java.net.URI |
getURI() |
java.net.URL |
getURL() |
boolean |
isOpen() |
long |
lastModified() |
public static AgentFileResourceImpl forNonExistingResource()
AgentFileStreamService.AgentFileResource
public static AgentFileStreamService.AgentFileResource forAgentFile(java.net.URI uri, long size, java.time.Instant lastModifiedTime, java.nio.file.Path relativePath, java.lang.String jobId, java.io.InputStream inputStream)
uri
- the resource URIsize
- the size of the file, as per latest manifestlastModifiedTime
- the last modification time, as per latest manifestrelativePath
- the path of the file relative to the root of the job directoryjobId
- the id of the job this file belongs toinputStream
- the input stream to read this file contentAgentFileStreamService.AgentFileResource
public boolean exists()
exists
in interface org.springframework.core.io.Resource
public boolean isOpen()
isOpen
in interface org.springframework.core.io.Resource
public java.net.URL getURL() throws java.io.IOException
getURL
in interface org.springframework.core.io.Resource
java.io.IOException
public java.net.URI getURI() throws java.io.IOException
getURI
in interface org.springframework.core.io.Resource
java.io.IOException
public java.io.File getFile() throws java.io.IOException
getFile
in interface org.springframework.core.io.Resource
java.io.IOException
public long contentLength() throws java.io.IOException
contentLength
in interface org.springframework.core.io.Resource
java.io.IOException
public long lastModified() throws java.io.IOException
lastModified
in interface org.springframework.core.io.Resource
java.io.IOException
public org.springframework.core.io.Resource createRelative(java.lang.String relativePath) throws java.io.IOException
createRelative
in interface org.springframework.core.io.Resource
java.io.IOException
public java.lang.String getFilename()
getFilename
in interface org.springframework.core.io.Resource
public java.lang.String getDescription()
getDescription
in interface org.springframework.core.io.Resource
public java.io.InputStream getInputStream() throws java.io.IOException
getInputStream
in interface org.springframework.core.io.InputStreamSource
java.io.IOException