1
0
mirror of https://github.com/json-iterator/go.git synced 2025-06-15 22:50:24 +02:00

write float 32

This commit is contained in:
Tao Wen
2017-01-07 23:06:48 +08:00
parent e034897e69
commit ba3c30799b
3 changed files with 83 additions and 1 deletions

View File

@ -104,7 +104,7 @@ func (b *Stream) Flush() error {
return nil
}
func (b *Stream) WriteString(s string) {
func (b *Stream) WriteRaw(s string) {
for len(s) > b.Available() && b.Error == nil {
n := copy(b.buf[b.n:], s)
b.n += n
@ -118,6 +118,22 @@ func (b *Stream) WriteString(s string) {
b.n += n
}
func (b *Stream) WriteString(s string) {
b.writeByte('"')
for len(s) > b.Available() && b.Error == nil {
n := copy(b.buf[b.n:], s)
b.n += n
s = s[n:]
b.Flush()
}
if b.Error != nil {
return
}
n := copy(b.buf[b.n:], s)
b.n += n
b.writeByte('"')
}
func (stream *Stream) WriteNull() {
stream.Write(bytesNull)
}