// writeCompressedChunk writes a compressed chunk to the underlying
// writer.
writeCompressedChunk writes a compressed chunk to the underlying
writer.
// writeCompressedChunk writes a compressed chunk to the underlying // writer .
func (w *Writer2) writeCompressedChunk() error {
	if w.ctype == cU || w.ctype == cUD {
		panic("chunk type uncompressed")
	}
	u := w.encoder.Compressed()
	if u <= 0 {
		return errors.New("writeCompressedChunk: empty chunk")
	}
	if u > maxUncompressed {
		panic("overrun of uncompressed data limit")
	}
	c := w.buf.Len()
	if c <= 0 {
		panic("no compressed data")
	}
	if c > maxCompressed {
		panic("overrun of compressed data limit")
	}
	header := chunkHeader{
		ctype:        w.ctype,
		uncompressed: uint32(u - 1),
		compressed:   uint16(c - 1),
		props:        w.encoder.state.Properties,
	}
	hdata, err := header.MarshalBinary()
	if err != nil {
		return err
	}
	if _, err = w.w.Write(hdata); err != nil {
		return err
	}
	_, err = io.Copy(w.w, &w.buf)
	return err
}
func ( w * Writer2 ) writeCompressedChunk ( ) error { if w . ctype == cU || w . ctype == cUD { panic ( " " ) } u := w . encoder . Compressed ( ) if u <= 0 { return errors . New ( " " ) } if u > maxUncompressed { panic ( " " ) } c := w . buf . Len ( ) if c <= 0 { panic ( " " ) } if c > maxCompressed { panic ( " " ) } header := chunkHeader { ctype : w . ctype , uncompressed : uint32 ( u - 1 ) , compressed : uint16 ( c - 1 ) , props : w . encoder . state . Properties , } hdata , err := header . MarshalBinary ( ) if err != nil { return err } if _ , err = w . w . Write ( hdata ) ; err != nil { return err } _ , err = io . Copy ( w . w , & w . buf ) return err }
writeCompressedChunk writes a compressed chunk to the underlying
writer.
writeCompressedChunk writes a compressed chunk to the underlying writer .