Package hudson.maven.reporters
Class MavenArtifact.TemporaryFile
- java.lang.Object
-
- hudson.maven.reporters.MavenArtifact.TemporaryFile
-
- All Implemented Interfaces:
Closeable
,AutoCloseable
- Enclosing class:
- MavenArtifact
public final class MavenArtifact.TemporaryFile extends Object implements Closeable
Representation of an archived artifact that might be accessed in various ways. Release in afinally
-block.- Since:
- 2.0.3
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
File
getFile()
Gets the artifact as a local file, perhaps creating a temporary copy as needed.VirtualFile
getVirtualFile()
Gets the artifact from whatever storage mechanism is appropriate.
-
-
-
Method Detail
-
getVirtualFile
@Nonnull public VirtualFile getVirtualFile()
Gets the artifact from whatever storage mechanism is appropriate. This is the preferred method for code that does not need to deal withFile
specifically.- Returns:
- the purported location of the artifact (might no longer exist if it has since been deleted)
-
getFile
@Nonnull public File getFile() throws IOException
Gets the artifact as a local file, perhaps creating a temporary copy as needed. You mustclose()
it when finished; do not delete the result file yourself.- Returns:
- either the original artifact, or a copy thereof; may not exist if it has since been deleted
- Throws:
IOException
-
close
public void close() throws IOException
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Throws:
IOException
-
-