info.sswap.ontologies.data.impl
Class LiteralData

java.lang.Object
  extended by info.sswap.ontologies.data.impl.AbstractData
      extended by info.sswap.ontologies.data.impl.LiteralData
All Implemented Interfaces:
Data, Parser, Serializer, Validator
Direct Known Subclasses:
AttachmentImpl

public class LiteralData
extends AbstractData

Support for reading and writing literal data (the value of the data:literalData predicate).

Author:
Damian Gessler

Field Summary
 
Fields inherited from class info.sswap.ontologies.data.impl.AbstractData
DataFormatType, sswapDocument, sswapIndividual
 
Constructor Summary
LiteralData(SSWAPIndividual sswapIndividual)
          Construct a literal data object for reading/writing.
 
Method Summary
 java.io.InputStream readData()
          Read the data, reading nothing (but no error) if there is no data to read.
 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, parse, serialize, setValue, stringToInputStream, validate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LiteralData

public LiteralData(SSWAPIndividual sswapIndividual)
            throws DataException
Construct a literal data object for reading/writing.

Parameters:
sswapIndividual - the data source or sink
Throws:
DataException - on any error establishing literal data support
Method Detail

readData

public java.io.InputStream readData()
                             throws java.io.IOException,
                                    DataException
Read the data, reading nothing (but no error) if there is no data to read.

The data source must be of type data:DataFormat for any meaningful read; otherwise a read "succeeds" with trivial empty content.

Returns:
InputStream a stream to read the data
Throws:
java.io.IOException - on any stream error
DataException - on data error such as parsing, validating, etc.

writeData

public void writeData(java.io.InputStream inputStream)
               throws java.io.IOException,
                      DataException
Write to the property data:literalData, creating one if needed

Parameters:
inputStream - stream from which to read the data to write
Throws:
java.io.IOException - on any stream error
DataException - on data error such as validating, serializing, etc.


Copyright (c) 2011, iPlant Collaborative, University of Arizona, Cold Spring Harbor Laboratories, University of Texas at Austin.