public class StructureReader extends Object implements WorkflowBundleReader
WorkflowBundleReader
that reads a WorkflowBundle
in Scufl2 Structure
format.Modifier and Type | Class and Description |
---|---|
static class |
StructureReader.Level |
Modifier and Type | Field and Description |
---|---|
protected Scanner |
scanner |
static String |
TEXT_VND_TAVERNA_SCUFL2_STRUCTURE |
Constructor and Description |
---|
StructureReader() |
Modifier and Type | Method and Description |
---|---|
Set<String> |
getMediaTypes()
Return the media types that this reader can read.
|
String |
guessMediaTypeForSignature(byte[] firstBytes)
Attempt to guess the media type for a stream or file that starts with
these bytes.
|
protected WorkflowBundle |
parse(InputStream is) |
protected void |
parseLine(String nextLine) |
WorkflowBundle |
readBundle(File bundleFile,
String mediaType)
Read a file containing a workflow bundle in the specified media type and
return a
WorkflowBundle . |
WorkflowBundle |
readBundle(InputStream inputStream,
String mediaType)
Read a stream containing a workflow bundle in the specified media type
and return a
WorkflowBundle . |
public static final String TEXT_VND_TAVERNA_SCUFL2_STRUCTURE
protected Scanner scanner
public Set<String> getMediaTypes()
WorkflowBundleReader
Returned media types are must be valid mediaType
arguments
to WorkflowBundleReader.readBundle(File, String)
and/or
WorkflowBundleReader.readBundle(InputStream, String)
for this reader.
It is recommended, but not required, that the reader can also recognise
those media types from WorkflowBundleReader.guessMediaTypeForSignature(byte[])
.
If the returned set is empty, the reader should should be able to
Recognise at least one media type from
WorkflowBundleReader.guessMediaTypeForSignature(byte[])
.
getMediaTypes
in interface WorkflowBundleReader
protected WorkflowBundle parse(InputStream is) throws ReaderException
ReaderException
protected void parseLine(String nextLine) throws ReaderException
ReaderException
public WorkflowBundle readBundle(File bundleFile, String mediaType) throws IOException, ReaderException
WorkflowBundleReader
WorkflowBundle
.readBundle
in interface WorkflowBundleReader
bundleFile
- the file containing the workflow bundlemediaType
- the media type of the workflow bundleWorkflowBundle
read from the fileIOException
- if there is an error reading the fileReaderException
- if there is an error parsing the workflow bundlepublic WorkflowBundle readBundle(InputStream inputStream, String mediaType) throws IOException, ReaderException
WorkflowBundleReader
WorkflowBundle
.readBundle
in interface WorkflowBundleReader
inputStream
- the stream containing the workflow bundlemediaType
- the media type of the workflow bundleWorkflowBundle
read from the streamIOException
- if there is an error reading from the streamReaderException
- if there is an error parsing the workflow bundlepublic String guessMediaTypeForSignature(byte[] firstBytes)
WorkflowBundleReader
Return null
if ambiguous (more than one possibility) or
unknown.
Typically a WorkflowBundleReader should be able to recognise the same
types as those listed in WorkflowBundleReader.getMediaTypes()
, but this is no
requirement. A WorkflowBundleReader could also recognise types not listed
in its WorkflowBundleReader.getMediaTypes()
.
guessMediaTypeForSignature
in interface WorkflowBundleReader
firstBytes
- The initial bytes, at least 512 bytes long unless the resource
is smaller.null
if the bytes were
ambiguous or unknown.Copyright © 2013 myGrid. All rights reserved.