// SerializeToString returns the string representation of the serializer(s)
// same as Serialize but returns string
11992
func (s Serializers) SerializeToString(key string, obj interface{}, options ...map[string]interface{}) (string, error) {
	result, err := s.Serialize(key, obj, options...)
	if err != nil {
		return "", err
	}

	return string(result), nil
}
844418
func (this *Converter) ConvertString(input string) (output string, err error) {
	// make sure we are still open
	if this.open {
		// construct the buffers
		inputBuffer := []byte(input)
		outputBuffer := make([]byte, len(inputBuffer)*2) // we use a larger buffer to help avoid resizing later

		// call Convert until all input bytes are read or an error occurs
		var bytesRead, totalBytesRead, bytesWritten, totalBytesWritten int

		for totalBytesRead < len(inputBuffer) && err == nil {
			// use the totals to create buffer slices
			bytesRead, bytesWritten, err = this.Convert(inputBuffer[totalBytesRead:], outputBuffer[totalBytesWritten:])

			totalBytesRead += bytesRead
			totalBytesWritten += bytesWritten

			// check for the E2BIG error specifically, we can add to the output
			// buffer to correct for it and then continue
			if err == syscall.E2BIG {
				// increase the size of the output buffer by another input length
				// first, create a new buffer
				tempBuffer := make([]byte, len(outputBuffer)+len(inputBuffer))

				// copy the existing data
				copy(tempBuffer, outputBuffer)

				// switch the buffers
				outputBuffer = tempBuffer

				// forget the error
				err = nil
			}
		}

		if err == nil {
			// perform a final shift state reset
			_, bytesWritten, err = this.Convert([]byte{}, outputBuffer[totalBytesWritten:])

			// update total count
			totalBytesWritten += bytesWritten
		}

		// construct the final output string
		output = string(outputBuffer[:totalBytesWritten])
	} else {
		err = syscall.EBADF
	}

	return output, err
}
271845
func (c Command) ToString() string {
	buf := new(bytes.Buffer)
	for _, arg := range c {
		buf.Write(arg)
		buf.WriteString(" ")
	}

	return strings.TrimSpace(buf.String())
}
858170
func (dsl *DestSmeList) SerializeTo(w io.Writer) error {
	_, err := w.Write(dsl.Bytes())
	return err
}
522781
func ToString(v Value) string {
	if s, ok := v.(String); ok {
		return string(s)
	}
	return StringOf(v)
}
781551
func BlockToString(block *common.Block) string {
	buff := &bytes.Buffer{}
	protolator.DeepMarshalJSON(buff, block)
	return buff.String()
}
710046
func (out *DataOutputImpl) WriteString(s string) error {
	bytes := []byte(s)
	err := out.WriteVInt(int32(len(bytes)))
	if err == nil {
		err = out.Writer.WriteBytes(bytes)
	}
	return err
}
760890
func (ds *DestSme) SerializeTo(w io.Writer) error {
	_, err := w.Write(ds.Bytes())
	return err
}
1156687
func jsonStringToObject(s string, v interface{}) error {
	data := []byte(s)
	return json.Unmarshal(data, v)
}
182956
func (e Encoder) ConvertString(s string) string {
	dest := make([]byte, len(s)+10)
	destPos := 0

	for _, rune := range s {
	retry:
		size, status := e(dest[destPos:], rune)

		if status == NO_ROOM {
			newDest := make([]byte, len(dest)*2)
			copy(newDest, dest)
			dest = newDest
			goto retry
		}

		if status == STATE_ONLY {
			destPos += size
			goto retry
		}

		destPos += size
	}

	return string(dest[:destPos])
}
924916
func (enc *Encoding) EncodeToString(b []byte) string {
	n := new(big.Int)
	r := new(big.Int)
	n.SetBytes(b)
	var result []byte
	for n.Cmp(zero) > 0 {
		n, r = n.DivMod(n, enc.base, r)
		result = append([]byte{enc.alphabet[r.Int64()]}, result...)
	}
	return string(result)
}
977880
func (e *Encoder) EncodeString(payloads ...string) error {
	for _, p := range payloads {
		if err := e.Encode([]byte(p)); err != nil {
			return err
		}
	}

	return nil
}
595829
func toString(v Value) string {
	var buf bytes.Buffer
	path := make([]Value, 0, 4)
	writeValue(&buf, v, path)
	return buf.String()
}
588608
func ToStringSig(n int64, sig float64) string {
	return ToStringSigBytesPerKB(n, sig, defaultBytesPerKB)
}
532117
func stringToBytes(s string) []byte {
	// The serialized format is:
	//   <size><string>
	//
	// 4 bytes string size + string
	size := len(s)
	buf := make([]byte, 4+size)
	copy(buf[0:4], uint32ToBytes(uint32(size)))
	copy(buf[4:4+size], s)
	return buf
}
1223407
func protocolToString(proto Protocol) string {
	switch proto {
	case syscall.IPPROTO_TCP:
		return "TCP"
	case syscall.IPPROTO_UDP:
		return "UDP"
	case syscall.IPPROTO_SCTP:
		return "SCTP"
	}
	return ""
}
706503
func Serialize(data interface{}) (bytes []byte, err error) {
	switch data.(type) {
	case []byte:
		return data.([]byte), nil
	case string:
		return []byte(data.(string)), nil
	default:
		if data != nil {
			return []byte(fmt.Sprint(data)), nil
		}
	}
	return nil, nil
}