public interface WorkflowBundleReader
WorkflowBundle
s.
Implementations specify workflow bundle formats (media types/mime types) that
they can read.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.
|
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 . |
Set<String> getMediaTypes()
Returned media types are must be valid mediaType
arguments
to readBundle(File, String)
and/or
readBundle(InputStream, String)
for this reader.
It is recommended, but not required, that the reader can also recognise
those media types from guessMediaTypeForSignature(byte[])
.
If the returned set is empty, the reader should should be able to
Recognise at least one media type from
guessMediaTypeForSignature(byte[])
.
WorkflowBundle readBundle(File bundleFile, String mediaType) throws ReaderException, IOException
WorkflowBundle
.bundleFile
- the file containing the workflow bundlemediaType
- the media type of the workflow bundleWorkflowBundle
read from the fileReaderException
- if there is an error parsing the workflow bundleIOException
- if there is an error reading the fileWorkflowBundle readBundle(InputStream inputStream, String mediaType) throws ReaderException, IOException
WorkflowBundle
.inputStream
- the stream containing the workflow bundlemediaType
- the media type of the workflow bundleWorkflowBundle
read from the streamReaderException
- if there is an error parsing the workflow bundleIOException
- if there is an error reading from the streamString guessMediaTypeForSignature(byte[] firstBytes)
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 getMediaTypes()
, but this is no
requirement. A WorkflowBundleReader could also recognise types not listed
in its getMediaTypes()
.
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.