Package org.spdx.tools
Class SpdxToolsHelper
java.lang.Object
org.spdx.tools.SpdxToolsHelper
public class SpdxToolsHelper extends Object
Static helper methods for the various tools
- Author:
- Gary O'Neall
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classSpdxToolsHelper.SerFileType -
Constructor Summary
Constructors Constructor Description SpdxToolsHelper() -
Method Summary
Modifier and Type Method Description static org.spdx.library.model.SpdxDocumentdeserializeDocument(File file)static org.spdx.library.model.SpdxDocumentdeserializeDocument(File file, SpdxToolsHelper.SerFileType fileType)static SpdxToolsHelper.SerFileTypefileToFileType(File file)static org.spdx.storage.ISerializableModelStorefileTypeToStore(SpdxToolsHelper.SerFileType fileType)static org.spdx.library.model.SpdxDocumentreadDocumentFromFile(org.spdx.storage.ISerializableModelStore store, File file)Reads an SPDX Document from a filestatic SpdxToolsHelper.SerFileTypestrToFileType(String str)
-
Constructor Details
-
SpdxToolsHelper
public SpdxToolsHelper()
-
-
Method Details
-
fileTypeToStore
public static org.spdx.storage.ISerializableModelStore fileTypeToStore(SpdxToolsHelper.SerFileType fileType) throws org.spdx.library.InvalidSPDXAnalysisException- Parameters:
fileType- file type for the store- Returns:
- the appropriate in memory based model store which supports serialization for the fileType
- Throws:
org.spdx.library.InvalidSPDXAnalysisException
-
fileToFileType
public static SpdxToolsHelper.SerFileType fileToFileType(File file) throws InvalidFileNameException- Parameters:
file-- Returns:
- the file type based on the file name and file extension
- Throws:
InvalidFileNameException
-
strToFileType
- Parameters:
str-- Returns:
- the file type based on the file extension or string
-
deserializeDocument
public static org.spdx.library.model.SpdxDocument deserializeDocument(File file) throws org.spdx.library.InvalidSPDXAnalysisException, IOException, InvalidFileNameException- Parameters:
file- file containing an SPDX document with the standard file extension for the serialization formats- Returns:
- the SPDX document stored in the file
- Throws:
org.spdx.library.InvalidSPDXAnalysisExceptionIOExceptionInvalidFileNameException
-
deserializeDocument
public static org.spdx.library.model.SpdxDocument deserializeDocument(File file, SpdxToolsHelper.SerFileType fileType) throws org.spdx.library.InvalidSPDXAnalysisException, IOException- Parameters:
file- file containing an SPDX document in one of the supported SerFileTypesfileType- serialization file type- Returns:
- the SPDX document stored in the file
- Throws:
org.spdx.library.InvalidSPDXAnalysisExceptionIOException
-
readDocumentFromFile
public static org.spdx.library.model.SpdxDocument readDocumentFromFile(org.spdx.storage.ISerializableModelStore store, File file) throws FileNotFoundException, IOException, org.spdx.library.InvalidSPDXAnalysisExceptionReads an SPDX Document from a file- Parameters:
store- Store where the document is to be storedfile- File to read the store from- Returns:
- SPDX Document from the store
- Throws:
FileNotFoundException- If the file is not foundIOException- If there is an error reading the fileorg.spdx.library.InvalidSPDXAnalysisException- If there is a problem in the SPDX document structure
-