| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
package jsontext |
| 8 |
|
| 9 |
import ( |
| 10 |
"io" |
| 11 |
|
| 12 |
"github.com/go-json-experiment/json/internal" |
| 13 |
) |
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
var Internal exporter |
| 18 |
|
| 19 |
type exporter struct{} |
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
func (exporter) Export(p *internal.NotForPublicUse) export { |
| 25 |
if p != &internal.AllowInternalUse { |
| 26 |
panic("unauthorized call to Export") |
| 27 |
} |
| 28 |
return export{} |
| 29 |
} |
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
|
| 37 |
|
| 38 |
type export struct{} |
| 39 |
|
| 40 |
|
| 41 |
func (export) Encoder(e *Encoder) *encoderState { return &e.s } |
| 42 |
|
| 43 |
|
| 44 |
func (export) Decoder(d *Decoder) *decoderState { return &d.s } |
| 45 |
|
| 46 |
func (export) GetBufferedEncoder(o ...Options) *Encoder { |
| 47 |
return getBufferedEncoder(o...) |
| 48 |
} |
| 49 |
func (export) PutBufferedEncoder(e *Encoder) { |
| 50 |
putBufferedEncoder(e) |
| 51 |
} |
| 52 |
|
| 53 |
func (export) GetStreamingEncoder(w io.Writer, o ...Options) *Encoder { |
| 54 |
return getStreamingEncoder(w, o...) |
| 55 |
} |
| 56 |
func (export) PutStreamingEncoder(e *Encoder) { |
| 57 |
putStreamingEncoder(e) |
| 58 |
} |
| 59 |
|
| 60 |
func (export) GetBufferedDecoder(b []byte, o ...Options) *Decoder { |
| 61 |
return getBufferedDecoder(b, o...) |
| 62 |
} |
| 63 |
func (export) PutBufferedDecoder(d *Decoder) { |
| 64 |
putBufferedDecoder(d) |
| 65 |
} |
| 66 |
|
| 67 |
func (export) GetStreamingDecoder(r io.Reader, o ...Options) *Decoder { |
| 68 |
return getStreamingDecoder(r, o...) |
| 69 |
} |
| 70 |
func (export) PutStreamingDecoder(d *Decoder) { |
| 71 |
putStreamingDecoder(d) |
| 72 |
} |
| 73 |
|
| 74 |
func (export) IsIOError(err error) bool { |
| 75 |
_, ok := err.(*ioError) |
| 76 |
return ok |
| 77 |
} |