()
| 55 | } |
| 56 | |
| 57 | func ExampleEncoder_Encode() { |
| 58 | type sparseBundleHeader struct { |
| 59 | InfoDictionaryVersion string `plist:"CFBundleInfoDictionaryVersion"` |
| 60 | BandSize uint64 `plist:"band-size"` |
| 61 | BackingStoreVersion int `plist:"bundle-backingstore-version"` |
| 62 | DiskImageBundleType string `plist:"diskimage-bundle-type"` |
| 63 | Size uint64 `plist:"size"` |
| 64 | } |
| 65 | data := &sparseBundleHeader{ |
| 66 | InfoDictionaryVersion: "6.0", |
| 67 | BandSize: 8388608, |
| 68 | Size: 4 * 1048576 * 1024 * 1024, |
| 69 | DiskImageBundleType: "com.apple.diskimage.sparsebundle", |
| 70 | BackingStoreVersion: 1, |
| 71 | } |
| 72 | |
| 73 | buf := &bytes.Buffer{} |
| 74 | encoder := NewEncoder(buf) |
| 75 | err := encoder.Encode(data) |
| 76 | if err != nil { |
| 77 | fmt.Println(err) |
| 78 | } |
| 79 | fmt.Println(buf.String()) |
| 80 | |
| 81 | // Output: <?xml version="1.0" encoding="UTF-8"?> |
| 82 | // <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> |
| 83 | // <plist version="1.0"><dict><key>CFBundleInfoDictionaryVersion</key><string>6.0</string><key>band-size</key><integer>8388608</integer><key>bundle-backingstore-version</key><integer>1</integer><key>diskimage-bundle-type</key><string>com.apple.diskimage.sparsebundle</string><key>size</key><integer>4398046511104</integer></dict></plist> |
| 84 | } |
| 85 | |
| 86 | func ExampleMarshal_xml() { |
| 87 | type sparseBundleHeader struct { |
nothing calls this directly
no test coverage detected