public abstract class MojoReaderBackend
extends java.lang.Object
implements java.io.Closeable
Interface representing a class capable of reading mojos. Usually the class implementing this interface will have a constructor taking an “address” of the mojo file that should be read. The class would then have to implement the logic for reading the referred mojo from the source.
For example, a hypothetical MysqlMojoReaderBackend may have a constructor taking the URL of the server, connection credentials, and a SQL query for retrieving the mojo record. The class would then implement the logic for connecting to the database and fetching the mojo (whole or in parts). It would also throw an IOException if anything fails.
The actual interface that the class needs to implement is for reading either text or binary fragments from within the mojo. This is because a .mojo file is actually a zip archive, and hence it contains several “files” inside. The user may decide to repackage the mojo contents into a different container: a plain directory for easier access, a .7z file for better compression, an encrypted Zip file for better security, etc. If the reader doesn’t wish to re-package the mojo contents and only retrieve it from non-filesystem source, then it may create a temporary .mojo file and pass it to the MojofileMojoReaderBackend reader.
| Constructor and Description |
|---|
MojoReaderBackend() |
MojoReaderBackend(java.lang.String baseDir) |
MojoReaderBackend(java.lang.String baseDir,
java.lang.String separator) |
MojoReaderBackend(java.lang.String baseDir,
java.lang.String separator,
java.lang.String pipelineFileName) |
| Modifier and Type | Method and Description |
|---|---|
abstract boolean |
exists(java.lang.String filename) |
java.lang.String |
getBaseDir() |
abstract byte[] |
getBinaryFile(java.lang.String filename)
Retrieve binary content inside the mojo, as a
byte[] array. |
abstract java.io.InputStream |
getFile(java.lang.String filename)
Retrieve content inside the mojo, as a
InputStream. |
java.io.BufferedReader |
getPipelineFile()
Deprecated.
|
java.lang.String |
getPipelineFileName() |
java.lang.String |
getSeparator() |
abstract java.io.BufferedReader |
getTextFile(java.lang.String filename)
Retrieve text content inside the mojo, as a
BufferedReader. |
public MojoReaderBackend()
public MojoReaderBackend(java.lang.String baseDir)
public MojoReaderBackend(java.lang.String baseDir,
java.lang.String separator)
public MojoReaderBackend(java.lang.String baseDir,
java.lang.String separator,
java.lang.String pipelineFileName)
public abstract java.io.InputStream getFile(java.lang.String filename)
throws java.io.IOException
Retrieve content inside the mojo, as a InputStream.
java.io.IOExceptionpublic abstract java.io.BufferedReader getTextFile(java.lang.String filename)
throws java.io.IOException
Retrieve text content inside the mojo, as a BufferedReader.
java.io.IOExceptionpublic abstract byte[] getBinaryFile(java.lang.String filename)
throws java.io.IOException
Retrieve binary content inside the mojo, as a byte[] array.
java.io.IOExceptionpublic abstract boolean exists(java.lang.String filename)
@Deprecated
public java.io.BufferedReader getPipelineFile()
throws java.io.IOException
java.io.IOExceptionpublic java.lang.String getPipelineFileName()
public java.lang.String getBaseDir()
public java.lang.String getSeparator()