Class Main

java.lang.Object
org.spdx.spdx_to_osv.Main

public class Main
extends Object
Utility to produce an OSV JSON file from an SPDX file See https://osv.dev/ for information on OSV The utility produces an output file OSVOutput.json in the OSV JSON format See https://docs.google.com/document/d/1sylBGNooKtf220RHQn1I8pZRmqXZQADDQ_TOABrKTpA/edit for output format
Author:
Gary O'Neall
  • Constructor Summary

    Constructors 
    Constructor Description
    Main()  
  • Method Summary

    Modifier and Type Method Description
    static void main​(String[] args)  
    static void spdxToOsv​(File fromFile, File toFile, org.spdx.tools.SpdxToolsHelper.SerFileType inputFileType, boolean allPackages)
    Produce an OSV Output File from an SPDX input file
    static void spdxToOsv​(InputStream inStream, org.spdx.tools.SpdxToolsHelper.SerFileType inputFileType, Writer writer, boolean allPackages)
    Writes OSV JSON data to the outStream based on an SPDX input stream
    static void spdxToOsv​(org.spdx.storage.IModelStore fromStore, String documentUri, Writer writer, boolean allPackages)
    Writes OSV JSON data to the outStream based on an SPDX model store and document URI

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Main

      public Main()
  • Method Details

    • main

      public static void main​(String[] args)
      Parameters:
      args - args[0] input SPDX file, args[1] output OSV JSON file
    • spdxToOsv

      public static void spdxToOsv​(File fromFile, File toFile, org.spdx.tools.SpdxToolsHelper.SerFileType inputFileType, boolean allPackages) throws SpdxToOsvException, IOException
      Produce an OSV Output File from an SPDX input file
      Parameters:
      fromFile - SPDX input file
      toFile - OSV output file
      inputFileType - Input file type for the SPDX file
      allPackage - if true, scan all packages in the document
      Throws:
      SpdxToOsvException
      IOException
    • spdxToOsv

      public static void spdxToOsv​(org.spdx.storage.IModelStore fromStore, String documentUri, Writer writer, boolean allPackages) throws SpdxToOsvException, IOException, org.spdx.library.InvalidSPDXAnalysisException
      Writes OSV JSON data to the outStream based on an SPDX model store and document URI
      Parameters:
      fromStore - Model store containing the SPDX model
      documentUri - Document URI for the document to use
      writer - writer the OSV file
      allPackage - if true, scan all packages in the document
      Throws:
      SpdxToOsvException
      IOException
      org.spdx.library.InvalidSPDXAnalysisException
    • spdxToOsv

      public static void spdxToOsv​(InputStream inStream, org.spdx.tools.SpdxToolsHelper.SerFileType inputFileType, Writer writer, boolean allPackages) throws SpdxToOsvException
      Writes OSV JSON data to the outStream based on an SPDX input stream
      Parameters:
      inStream - Stream for the SPDX file
      inputFileType - Serialization type for the input file stream
      writer - writer the OSV file
      allPackage - if true, scan all packages in the document
      Throws:
      SpdxToOsvException