func (page *PageHeader) Write(w io.Writer) (int, error) { wc := NewCountingWriter(w) ttransport := &thrift.StreamTransport{Writer: wc} proto := thrift.NewTCompactProtocol(ttransport) err := page.write(proto) return int(wc.N), err }
// Column Chunk Writer func (cc *ColumnChunk) Write(w io.Writer) (int, error) { wc := NewCountingWriter(w) ttransport := &thrift.StreamTransport{Writer: wc} proto := thrift.NewTCompactProtocol(ttransport) err := cc.write(proto) return int(wc.N), err }
// FileMetaData.Write writes the object to a io.Writer. func (meta *FileMetaData) Write(w io.Writer) (int64, error) { wc := NewCountingWriter(w) ttransport := &thrift.StreamTransport{Writer: wc} proto := thrift.NewTCompactProtocol(ttransport) err := meta.write(proto) return wc.N, err }
func NewLineClient() (*LineClient, error) { transport, err := thrift.NewTHttpPostClient(LINE_HTTP_URL) if err != nil { return nil, err } httpTrans := transport.(*thrift.THttpClient) header := &http.Header{} header.Add("User-Agent", LINE_USER_AGENT) httpTrans.SetHeader("User-Agent", LINE_USER_AGENT) header.Add("X-LINE-Application", LINE_X_LINE_APPLICATION) httpTrans.SetHeader("X-Line-Application", LINE_X_LINE_APPLICATION) protocol := thrift.NewTCompactProtocol(transport) client := prot.NewTalkServiceClientProtocol(transport, protocol, protocol) return &LineClient{client: client, IP: lookupIP(), Hostname: lookupHostname(), header: header}, nil }
func newProtocol(r io.Reader) *thrift.TCompactProtocol { ttransport := &thrift.StreamTransport{Reader: r} return thrift.NewTCompactProtocol(ttransport) }