Package org.spdx.library
Class Read
java.lang.Object
org.spdx.library.Read
public class Read extends Object
Supports reading SPDX documents from an existing ModelStore
Some design and some implementation borrowed from Yevster's spdxtra project under the Apache 2.0 license
http://yevster.github.io/spdxtra/
- Author:
- Gary O'Neall
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classRead.Document -
Constructor Summary
Constructors Constructor Description Read() -
Method Summary
Modifier and Type Method Description static Stream<? extends ModelObject>getAllItems(IModelStore modelStore, String documentUri, String typeFilter)static Stream<SpdxPackage>getAllPackages(IModelStore modelStore, String documentUri)static voidserialize(ISerializableModelStore modelStore, String documentUri, OutputStream stream)Serializes an SPDX document stored in the modelStore.static voidwriteToFile(ISerializableModelStore modelStore, String documentUri, Path filePath)Write the SPDX document stored in the modelStore to a file
-
Constructor Details
-
Read
public Read()
-
-
Method Details
-
serialize
public static void serialize(ISerializableModelStore modelStore, String documentUri, OutputStream stream) throws InvalidSPDXAnalysisException, IOExceptionSerializes an SPDX document stored in the modelStore. The specific format of the serialization will depend on the modelStore.- Parameters:
modelStore- Storage for the model objectsdocumentUri- SPDX Document URI for a document associated with this modelstream- Output stream for serialization- Throws:
InvalidSPDXAnalysisExceptionIOException
-
writeToFile
public static void writeToFile(ISerializableModelStore modelStore, String documentUri, Path filePath) throws InvalidSPDXAnalysisException, IOExceptionWrite the SPDX document stored in the modelStore to a file- Parameters:
modelStore- Storage for the model objectsdocumentUri- SPDX Document URI for a document associated with this modelfilePath- File path to output the file- Throws:
InvalidSPDXAnalysisExceptionIOException
-
getAllItems
public static Stream<? extends ModelObject> getAllItems(IModelStore modelStore, String documentUri, String typeFilter) throws InvalidSPDXAnalysisException- Parameters:
modelStore- Storage for the model objectsdocumentUri- SPDX Document URI for a document associated with this modeltypeFilter- Optional parameter to specify the type of objects to be retrieved- Returns:
- Stream of all items store within the document
- Throws:
InvalidSPDXAnalysisException
-
getAllPackages
public static Stream<SpdxPackage> getAllPackages(IModelStore modelStore, String documentUri) throws InvalidSPDXAnalysisException- Parameters:
modelStore- Storage for the model objectsdocumentUri- SPDX Document URI for a document associated with this model- Returns:
- All packages stored for the document in the model store
- Throws:
InvalidSPDXAnalysisException
-