本文整理匯總了Golang中github.com/FactomProject/factomd/common/primitives.Buffer.WriteString方法的典型用法代碼示例。如果您正苦於以下問題:Golang Buffer.WriteString方法的具體用法?Golang Buffer.WriteString怎麽用?Golang Buffer.WriteString使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/FactomProject/factomd/common/primitives.Buffer
的用法示例。
在下文中一共展示了Buffer.WriteString方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: CustomMarshalText
func (a *Address) CustomMarshalText() (text []byte, err error) {
var out primitives.Buffer
addr := hex.EncodeToString(a.Bytes())
out.WriteString("addr ")
out.WriteString(addr)
return out.DeepCopyBytes(), nil
}
示例2: String
func (e *ECBlockBody) String() string {
var out primitives.Buffer
for _, v := range e.Entries {
out.WriteString(v.String())
}
return string(out.DeepCopyBytes())
}
示例3: String
func (e *EBlockBody) String() string {
var out primitives.Buffer
for _, eh := range e.EBEntries {
out.WriteString(fmt.Sprintf(" %20s: %x\n", "Entry Hash", eh.Bytes()[:3]))
}
return (string)(out.DeepCopyBytes())
}
示例4: String
func (e *AddReplaceMatryoshkaHash) String() string {
var out primitives.Buffer
out.WriteString(fmt.Sprintf(" E: %35s -- %17s %8x %12s %8s\n",
"AddReplaceMatryoshkaHash",
"IdentityChainID", e.IdentityChainID.Bytes()[:4],
"MHash", e.MHash.String()[:8]))
return (string)(out.DeepCopyBytes())
}
示例5: String
func (e *AddFederatedServerBitcoinAnchorKey) String() string {
var out primitives.Buffer
out.WriteString(fmt.Sprintf(" E: %35s -- %17s %8x %12s %8x %12s %8x %12s %8s\n",
"AddFederatedServerBitcoinAnchorKey",
"IdentityChainID", e.IdentityChainID.Bytes()[:4],
"KeyPriority", e.KeyPriority,
"KeyType", e.KeyType,
"ECDSAPublicKey", e.ECDSAPublicKey.String()[:8]))
return (string)(out.DeepCopyBytes())
}
示例6: String
func (e *AddFederatedServerSigningKey) String() string {
var out primitives.Buffer
out.WriteString(fmt.Sprintf(" E: %35s -- %17s %8x %12s %8x %12s %8s %12s %d\n",
"AddFederatedServerSigningKey",
"IdentityChainID", e.IdentityChainID.Bytes()[:4],
"KeyPriority", e.KeyPriority,
"PublicKey", e.PublicKey.String()[:8],
"DBHeight", e.DBHeight))
return (string)(out.DeepCopyBytes())
}
示例7: CustomMarshalTextAll
// Make this into somewhat readable text.
func (ta TransAddress) CustomMarshalTextAll(fct bool, label string) ([]byte, error) {
var out primitives.Buffer
out.WriteString(fmt.Sprintf(" %8s:", label))
v := primitives.ConvertDecimalToPaddedString(ta.Amount)
fill := 8 - len(v) + strings.Index(v, ".") + 1
fstr := fmt.Sprintf("%%%vs%%%vs ", 18-fill, fill)
out.WriteString(fmt.Sprintf(fstr, v, ""))
if fct {
out.WriteString(primitives.ConvertFctAddressToUserStr(ta.Address))
} else {
out.WriteString(primitives.ConvertECAddressToUserStr(ta.Address))
}
str := fmt.Sprintf("\n %016x %038s\n\n", ta.Amount, string(hex.EncodeToString(ta.GetAddress().Bytes())))
out.WriteString(str)
return out.DeepCopyBytes(), nil
}
示例8: CustomMarshalText
func (a RCD_1) CustomMarshalText() (text []byte, err error) {
var out primitives.Buffer
out.WriteString("RCD 1: ")
primitives.WriteNumber8(&out, uint8(1)) // Type Zero Authorization
out.WriteString(" ")
out.WriteString(hex.EncodeToString(a.PublicKey[:]))
out.WriteString("\n")
return out.DeepCopyBytes(), nil
}
示例9: String
func (c *AdminBlock) String() string {
var out primitives.Buffer
fh, _ := c.BackReferenceHash()
if fh == nil {
fh = primitives.NewZeroHash()
}
out.WriteString(fmt.Sprintf("%20s %x\n", "Primary Hash:", c.DatabasePrimaryIndex().Bytes()))
out.WriteString(fmt.Sprintf("%20s %x\n", "512 Sha3:", fh.Bytes()))
out.WriteString(c.Header.String())
out.WriteString("Entries: \n")
for _, entry := range c.ABEntries {
out.WriteString(entry.String())
}
return (string)(out.DeepCopyBytes())
}
示例10: CustomMarshalText
func (s FactoidSignature) CustomMarshalText() ([]byte, error) {
var out primitives.Buffer
out.WriteString(" FactoidSignature: ")
out.WriteString(hex.EncodeToString(s.Signature[:]))
out.WriteString("\n")
return out.DeepCopyBytes(), nil
}
示例11: String
func (e *IncreaseBalance) String() string {
var out primitives.Buffer
out.WriteString(fmt.Sprintf(" %-20s\n", "IncreaseBalance"))
out.WriteString(fmt.Sprintf(" %-20s %x\n", "ECPubKey", e.ECPubKey[:3]))
out.WriteString(fmt.Sprintf(" %-20s %x\n", "TXID", e.TXID.Bytes()[:3]))
out.WriteString(fmt.Sprintf(" %-20s %d\n", "Index", e.Index))
out.WriteString(fmt.Sprintf(" %-20s %x\n", "NumEC", e.NumEC))
return (string)(out.DeepCopyBytes())
}
示例12: CustomMarshalText
func (s SignatureBlock) CustomMarshalText() ([]byte, error) {
var out primitives.Buffer
out.WriteString("Signature Block: \n")
for _, sig := range s.Signatures {
out.WriteString(" signature: ")
txt, err := sig.CustomMarshalText()
if err != nil {
return nil, err
}
out.Write(txt)
out.WriteString("\n ")
}
return out.DeepCopyBytes(), nil
}
示例13: CustomMarshalText
func (a RCD_2) CustomMarshalText() ([]byte, error) {
var out primitives.Buffer
primitives.WriteNumber8(&out, uint8(2)) // Type 2 Authorization
out.WriteString("\n n: ")
primitives.WriteNumber16(&out, uint16(a.N))
out.WriteString(" m: ")
primitives.WriteNumber16(&out, uint16(a.M))
out.WriteString("\n")
for i := 0; i < a.M; i++ {
out.WriteString(" m: ")
out.WriteString(hex.EncodeToString(a.N_Addresses[i].Bytes()))
out.WriteString("\n")
}
return out.DeepCopyBytes(), nil
}
示例14: String
func (e *EBlockHeader) String() string {
var out primitives.Buffer
out.WriteString(" Entry Block Header\n")
out.WriteString(fmt.Sprintf(" %20s: %x\n", "ChainID", e.ChainID.Bytes()[:3]))
out.WriteString(fmt.Sprintf(" %20s: %x\n", "BodyMR", e.BodyMR.Bytes()[:3]))
out.WriteString(fmt.Sprintf(" %20s: %x\n", "PrevKeyMR", e.PrevKeyMR.Bytes()[:3]))
out.WriteString(fmt.Sprintf(" %20s: %x\n", "PrevFullHash", e.PrevFullHash.Bytes()[:3]))
out.WriteString(fmt.Sprintf(" %20s: %10v\n", "EBSequence", e.EBSequence))
out.WriteString(fmt.Sprintf(" %20s: %10v\n", "DBHeight", e.DBHeight))
out.WriteString(fmt.Sprintf(" %20s: %x\n", "EntryCount", e.EntryCount))
return (string)(out.DeepCopyBytes())
}
示例15: String
func (e *ABlockHeader) String() string {
var out primitives.Buffer
out.WriteString(" Admin Block Header\n")
out.WriteString(fmt.Sprintf(" %20s: %10v\n", "PrevBackRefHash", e.PrevBackRefHash.String()))
out.WriteString(fmt.Sprintf(" %20s: %10v\n", "DBHeight", e.DBHeight))
out.WriteString(fmt.Sprintf(" %20s: %10v\n", "HeaderExpansionSize", e.HeaderExpansionSize))
out.WriteString(fmt.Sprintf(" %20s: %x\n", "HeaderExpansionArea", e.HeaderExpansionArea))
out.WriteString(fmt.Sprintf(" %20s: %x\n", "MessageCount", e.MessageCount))
out.WriteString(fmt.Sprintf(" %20s: %x\n", "MessageCount", e.BodySize))
return (string)(out.DeepCopyBytes())
}