Package io.protostuff

Class YamlIOUtil


  • public final class YamlIOUtil
    extends java.lang.Object
    Utility for the YAML serialization of messages and objects tied to a schema.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private static byte[] START_DIRECTIVE  
    • Constructor Summary

      Constructors 
      Constructor Description
      YamlIOUtil()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static <T> byte[] toByteArray​(T message, Schema<T> schema, LinkedBuffer buffer)
      Serializes the message into a byte array with the supplied buffer.
      static <T> int writeListTo​(LinkedBuffer buffer, java.util.List<T> messages, Schema<T> schema)
      Serializes the messages a LinkedBuffer using the given schema.
      static <T> int writeListTo​(java.io.OutputStream out, java.util.List<T> messages, Schema<T> schema, LinkedBuffer buffer)
      Serializes the messages into an OutputStream using the given schema with the supplied buffer.
      static <T> int writeTo​(LinkedBuffer buffer, T message, Schema<T> schema)
      Serializes the message into the LinkedBuffer.
      static <T> int writeTo​(java.io.OutputStream out, T message, Schema<T> schema, LinkedBuffer buffer)
      Serializes the message into an OutputStream with the supplied buffer.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • START_DIRECTIVE

        private static final byte[] START_DIRECTIVE
    • Constructor Detail

      • YamlIOUtil

        public YamlIOUtil()
    • Method Detail

      • toByteArray

        public static <T> byte[] toByteArray​(T message,
                                             Schema<T> schema,
                                             LinkedBuffer buffer)
        Serializes the message into a byte array with the supplied buffer.
      • writeTo

        public static <T> int writeTo​(LinkedBuffer buffer,
                                      T message,
                                      Schema<T> schema)
        Serializes the message into the LinkedBuffer.
        Returns:
        the total bytes written to the output.
      • writeTo

        public static <T> int writeTo​(java.io.OutputStream out,
                                      T message,
                                      Schema<T> schema,
                                      LinkedBuffer buffer)
                               throws java.io.IOException
        Serializes the message into an OutputStream with the supplied buffer.
        Returns:
        the total bytes written to the output.
        Throws:
        java.io.IOException
      • writeListTo

        public static <T> int writeListTo​(LinkedBuffer buffer,
                                          java.util.List<T> messages,
                                          Schema<T> schema)
        Serializes the messages a LinkedBuffer using the given schema.
        Returns:
        the total bytes written to the output.
      • writeListTo

        public static <T> int writeListTo​(java.io.OutputStream out,
                                          java.util.List<T> messages,
                                          Schema<T> schema,
                                          LinkedBuffer buffer)
                                   throws java.io.IOException
        Serializes the messages into an OutputStream using the given schema with the supplied buffer.
        Returns:
        the total bytes written to the output.
        Throws:
        java.io.IOException