|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectinfo.sswap.ontologies.data.impl.AbstractData
info.sswap.ontologies.data.impl.LiteralData
info.sswap.ontologies.data.impl.AttachmentImpl
public class AttachmentImpl
Implementation of support for "attachments"; i.e., base64 encoding of literal data
Field Summary |
---|
Fields inherited from class info.sswap.ontologies.data.impl.AbstractData |
---|
DataFormatType, sswapDocument, sswapIndividual |
Constructor Summary | |
---|---|
AttachmentImpl(SSWAPIndividual sswapIndividual)
Enables reading and writing of literal data as base64 "attachments". |
Method Summary | |
---|---|
java.io.InputStream |
parse(java.io.InputStream inputStream)
Uses the default base64 parser if and only if there is a data:hasParser property with the default value
(Base64Parser.uri ). |
java.io.InputStream |
readData()
Read the data, reading nothing (but no error) if there is no data to read. |
java.io.InputStream |
serialize(java.io.InputStream inputStream)
Uses the default base64 serializer if and only if there is a data:hasSerializer property with the default value
(Base64Serializer.uri ). |
private void |
setFilter(java.net.URI xsdbase64Binary,
java.net.URI hasFilterPredicate,
java.net.URI base64uri)
Set the parser or serializer depending on the datatype of the data or the ontology predicate value. |
void |
writeData(java.io.InputStream inputStream)
Write to the property data:literalData, creating one if needed |
Methods inherited from class info.sswap.ontologies.data.impl.AbstractData |
---|
getAccessors, getFormats, getIndividual, getParsers, getSerializers, getValidators, hasValue, inputStreamToString, setValue, stringToInputStream, validate |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public AttachmentImpl(SSWAPIndividual sswapIndividual) throws DataAccessException
sswapIndividual
- the individual holding access to the data
DataAccessException
- on any data access errorMethod Detail |
---|
public java.io.InputStream readData() throws java.io.IOException, DataException
LiteralData
The data source must be of type data:DataFormat
for any
meaningful read; otherwise a read "succeeds" with trivial empty content.
readData
in interface Data
readData
in class LiteralData
java.io.IOException
- on any stream error
DataException
- on data error such as parsing, validating, etc.public void writeData(java.io.InputStream inputStream) throws java.io.IOException, DataException
LiteralData
writeData
in interface Data
writeData
in class LiteralData
inputStream
- stream from which to read the data to write
java.io.IOException
- on any stream error
DataException
- on data error such as validating, serializing, etc.public java.io.InputStream parse(java.io.InputStream inputStream) throws java.io.IOException, ParserException
data:hasParser
property with the default value
(Base64Parser.uri
).
For other parsers, override this method to return a parsed input stream suitable for reading.
parse
in interface Parser
parse
in class AbstractData
inputStream
- raw (unparsed) stream to be read
java.io.IOException
- on any network error
ParserException
- on any Parser-specific errorBase64Parser.uri
public java.io.InputStream serialize(java.io.InputStream inputStream) throws java.io.IOException, SerializerException
data:hasSerializer
property with the default value
(Base64Serializer.uri
).
For other serializers, override this method to return a serialized input stream suitable for reading by the internal writer.
serialize
in interface Serializer
serialize
in class AbstractData
inputStream
- raw (un-serialized) stream to be read
java.io.IOException
- on any network error
SerializerException
- on any Serializer-specific errorBase64Serializer.uri
private void setFilter(java.net.URI xsdbase64Binary, java.net.URI hasFilterPredicate, java.net.URI base64uri)
xsdbase64Binary
- the URI of the XSD base64Binary type (e.g.,
Base64Parser.XSDbase64Binary or
Base64Serializer.XSDbase64Binary)hasFilterPredicate
- the URI of the data ontology predicate for associating with a
filter (e.g., Ontology.hasParser or Ontology.hasSerializer)base64uri
- the marker URN for base64 encoding or decoding (e.g.,
Base64Parser.uri or Base64Serializer.uri)Base64Parser
,
Base64Serializer
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |