Files
rk35xx-android14/external/spdx-tools/json/writer.go
T
hmz007 36ed224bac Rockchip Anroid14_SDK 20240628-rkr5 (2556df1a)
Signed-off-by: hmz007 <hmz007@gmail.com>
Change-Id: Ib87fdbe7a0be7dc961af3500fe9ea4589a127f9f
2024-10-29 18:12:02 +08:00

42 lines
820 B
Go

// SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
package spdx_json
import (
"encoding/json"
"github.com/spdx/tools-golang/spdx/v2_3"
"io"
"github.com/spdx/tools-golang/spdx/v2_2"
)
// Save2_2 takes an SPDX Document (version 2.2) and an io.Writer, and writes the document to the writer in JSON format.
func Save2_2(doc *v2_2.Document, w io.Writer) error {
buf, err := json.Marshal(doc)
if err != nil {
return err
}
_, err = w.Write(buf)
if err != nil {
return err
}
return nil
}
// Save2_3 takes an SPDX Document (version 2.2) and an io.Writer, and writes the document to the writer in JSON format.
func Save2_3(doc *v2_3.Document, w io.Writer) error {
buf, err := json.Marshal(doc)
if err != nil {
return err
}
_, err = w.Write(buf)
if err != nil {
return err
}
return nil
}