当前位置: 首页>>代码示例>>Golang>>正文


Golang Writer.WriteString方法代码示例

本文整理汇总了Golang中github.com/calmh/syncthing/xdr.Writer.WriteString方法的典型用法代码示例。如果您正苦于以下问题:Golang Writer.WriteString方法的具体用法?Golang Writer.WriteString怎么用?Golang Writer.WriteString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在github.com/calmh/syncthing/xdr.Writer的用法示例。


在下文中一共展示了Writer.WriteString方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1: encodeXDR

func (o CloseMessage) encodeXDR(xw *xdr.Writer) (int, error) {
	if len(o.Reason) > 1024 {
		return xw.Tot(), xdr.ErrElementSizeExceeded
	}
	xw.WriteString(o.Reason)
	return xw.Tot(), xw.Error()
}
开发者ID:retgoat,项目名称:syncthing,代码行数:7,代码来源:message_xdr.go

示例2: encodeXDR

func (o ClusterConfigMessage) encodeXDR(xw *xdr.Writer) (int, error) {
	if len(o.ClientName) > 64 {
		return xw.Tot(), xdr.ErrElementSizeExceeded
	}
	xw.WriteString(o.ClientName)
	if len(o.ClientVersion) > 64 {
		return xw.Tot(), xdr.ErrElementSizeExceeded
	}
	xw.WriteString(o.ClientVersion)
	if len(o.Repositories) > 64 {
		return xw.Tot(), xdr.ErrElementSizeExceeded
	}
	xw.WriteUint32(uint32(len(o.Repositories)))
	for i := range o.Repositories {
		o.Repositories[i].encodeXDR(xw)
	}
	if len(o.Options) > 64 {
		return xw.Tot(), xdr.ErrElementSizeExceeded
	}
	xw.WriteUint32(uint32(len(o.Options)))
	for i := range o.Options {
		o.Options[i].encodeXDR(xw)
	}
	return xw.Tot(), xw.Error()
}
开发者ID:jjoergensen,项目名称:syncthing,代码行数:25,代码来源:message_xdr.go

示例3: encodeXDR

func (o QueryV2) encodeXDR(xw *xdr.Writer) (int, error) {
	xw.WriteUint32(o.Magic)
	if len(o.NodeID) > 64 {
		return xw.Tot(), xdr.ErrElementSizeExceeded
	}
	xw.WriteString(o.NodeID)
	return xw.Tot(), xw.Error()
}
开发者ID:nbrownus,项目名称:syncthing,代码行数:8,代码来源:packets_xdr.go

示例4: encodeXDR

func (o Node) encodeXDR(xw *xdr.Writer) (int, error) {
	if len(o.ID) > 64 {
		return xw.Tot(), xdr.ErrElementSizeExceeded
	}
	xw.WriteString(o.ID)
	xw.WriteUint32(o.Flags)
	return xw.Tot(), xw.Error()
}
开发者ID:nbrownus,项目名称:syncthing,代码行数:8,代码来源:message_xdr.go

示例5: encodeXDR

func (o TestStruct) encodeXDR(xw *xdr.Writer) (int, error) {
	xw.WriteUint64(uint64(o.I))
	xw.WriteUint16(uint16(o.I16))
	xw.WriteUint16(o.UI16)
	xw.WriteUint32(uint32(o.I32))
	xw.WriteUint32(o.UI32)
	xw.WriteUint64(uint64(o.I64))
	xw.WriteUint64(o.UI64)
	xw.WriteBytes(o.BS)
	xw.WriteString(o.S)
	return xw.Tot(), xw.Error()
}
开发者ID:KayoticSully,项目名称:syncthing,代码行数:12,代码来源:encdec_xdr_test.go

示例6: encodeXDR

func (o AnnounceV1) encodeXDR(xw *xdr.Writer) (int, error) {
	xw.WriteUint32(o.Magic)
	xw.WriteUint16(o.Port)
	if len(o.NodeID) > 64 {
		return xw.Tot(), xdr.ErrElementSizeExceeded
	}
	xw.WriteString(o.NodeID)
	if len(o.IP) > 16 {
		return xw.Tot(), xdr.ErrElementSizeExceeded
	}
	xw.WriteBytes(o.IP)
	return xw.Tot(), xw.Error()
}
开发者ID:ngpestelos,项目名称:syncthing,代码行数:13,代码来源:packets_xdr.go

示例7: encodeXDR

func (o File) encodeXDR(xw *xdr.Writer) (int, error) {
	xw.WriteString(o.Name)
	xw.WriteUint32(o.Flags)
	xw.WriteUint64(uint64(o.Modified))
	xw.WriteUint64(o.Version)
	xw.WriteUint64(uint64(o.Size))
	xw.WriteUint32(uint32(len(o.Blocks)))
	for i := range o.Blocks {
		o.Blocks[i].encodeXDR(xw)
	}
	xw.WriteBool(o.Suppressed)
	return xw.Tot(), xw.Error()
}
开发者ID:jjoergensen,项目名称:syncthing,代码行数:13,代码来源:file_xdr.go

示例8: encodeXDR

func (o Node) encodeXDR(xw *xdr.Writer) (int, error) {
	if len(o.ID) > 64 {
		return xw.Tot(), xdr.ErrElementSizeExceeded
	}
	xw.WriteString(o.ID)
	if len(o.Addresses) > 16 {
		return xw.Tot(), xdr.ErrElementSizeExceeded
	}
	xw.WriteUint32(uint32(len(o.Addresses)))
	for i := range o.Addresses {
		o.Addresses[i].encodeXDR(xw)
	}
	return xw.Tot(), xw.Error()
}
开发者ID:BillTheBest,项目名称:syncthing,代码行数:14,代码来源:packets_xdr.go

示例9: encodeXDR

func (o XDRBenchStruct) encodeXDR(xw *xdr.Writer) (int, error) {
	xw.WriteUint64(o.I1)
	xw.WriteUint32(o.I2)
	xw.WriteUint16(o.I3)
	if len(o.Bs0) > 128 {
		return xw.Tot(), xdr.ErrElementSizeExceeded
	}
	xw.WriteBytes(o.Bs0)
	xw.WriteBytes(o.Bs1)
	if len(o.S0) > 128 {
		return xw.Tot(), xdr.ErrElementSizeExceeded
	}
	xw.WriteString(o.S0)
	xw.WriteString(o.S1)
	return xw.Tot(), xw.Error()
}
开发者ID:BenKoerber,项目名称:syncthing,代码行数:16,代码来源:bench_xdr_test.go


注:本文中的github.com/calmh/syncthing/xdr.Writer.WriteString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。