Package org.fressian

Class FressianWriter

    • Constructor Detail

      • FressianWriter

        public FressianWriter​(java.io.OutputStream out)
      • FressianWriter

        public FressianWriter​(java.io.OutputStream out,
                              ILookup<java.lang.Class,​java.util.Map<java.lang.String,​WriteHandler>> userHandlers)
        Create a writer that combines userHandlers with the normal type handlers built into Fressian.
    • Method Detail

      • writeNull

        public Writer writeNull()
                         throws java.io.IOException
        Specified by:
        writeNull in interface Writer
        Throws:
        java.io.IOException
      • writeBoolean

        public Writer writeBoolean​(boolean b)
                            throws java.io.IOException
        Specified by:
        writeBoolean in interface Writer
        Throws:
        java.io.IOException
      • writeBoolean

        public Writer writeBoolean​(java.lang.Object o)
                            throws java.io.IOException
        Specified by:
        writeBoolean in interface Writer
        Throws:
        java.io.IOException
      • writeInt

        public Writer writeInt​(long i)
                        throws java.io.IOException
        Specified by:
        writeInt in interface Writer
        Throws:
        java.io.IOException
      • writeInt

        public Writer writeInt​(java.lang.Object o)
                        throws java.io.IOException
        Specified by:
        writeInt in interface Writer
        Throws:
        java.io.IOException
      • writeDouble

        public Writer writeDouble​(double d)
                           throws java.io.IOException
        Specified by:
        writeDouble in interface Writer
        Throws:
        java.io.IOException
      • writeDouble

        public Writer writeDouble​(java.lang.Object o)
                           throws java.io.IOException
        Specified by:
        writeDouble in interface Writer
        Throws:
        java.io.IOException
      • writeFloat

        public Writer writeFloat​(float f)
                          throws java.io.IOException
        Specified by:
        writeFloat in interface Writer
        Throws:
        java.io.IOException
      • writeFloat

        public Writer writeFloat​(java.lang.Object o)
                          throws java.io.IOException
        Specified by:
        writeFloat in interface Writer
        Throws:
        java.io.IOException
      • writeString

        public Writer writeString​(java.lang.Object o)
                           throws java.io.IOException
        Specified by:
        writeString in interface Writer
        Throws:
        java.io.IOException
      • writeList

        public Writer writeList​(java.lang.Object o)
                         throws java.io.IOException
        Specified by:
        writeList in interface Writer
        Throws:
        java.io.IOException
      • writeBytes

        public Writer writeBytes​(byte[] b)
                          throws java.io.IOException
        Specified by:
        writeBytes in interface Writer
        Throws:
        java.io.IOException
      • writeBytes

        public Writer writeBytes​(byte[] b,
                                 int offset,
                                 int length)
                          throws java.io.IOException
        Specified by:
        writeBytes in interface Writer
        Throws:
        java.io.IOException
      • writeFooterFor

        public void writeFooterFor​(java.nio.ByteBuffer bb)
                            throws java.io.IOException
        Description copied from interface: StreamingWriter
        Write a footer for some existing fressianed data (the readable portion of bb.) For advanced use when building a larger fressianed stream from existing content.
        Specified by:
        writeFooterFor in interface StreamingWriter
        Throws:
        java.io.IOException
      • writeFooter

        public Writer writeFooter()
                           throws java.io.IOException
        Specified by:
        writeFooter in interface Writer
        Throws:
        java.io.IOException
      • resetCaches

        public Writer resetCaches()
                           throws java.io.IOException
        Specified by:
        resetCaches in interface Writer
        Throws:
        java.io.IOException
      • writeTag

        public Writer writeTag​(java.lang.Object tag,
                               int componentCount)
                        throws java.io.IOException
        Specified by:
        writeTag in interface Writer
        Throws:
        java.io.IOException
      • writeExt

        public Writer writeExt​(java.lang.Object tag,
                               java.lang.Object... fields)
                        throws java.io.IOException
        Throws:
        java.io.IOException
      • writeCount

        public void writeCount​(int count)
                        throws java.io.IOException
        Throws:
        java.io.IOException
      • writeAs

        public Writer writeAs​(java.lang.String tag,
                              java.lang.Object o,
                              boolean cache)
                       throws java.io.IOException
        Specified by:
        writeAs in interface Writer
        Throws:
        java.io.IOException
      • writeAs

        public Writer writeAs​(java.lang.String tag,
                              java.lang.Object o)
                       throws java.io.IOException
        Specified by:
        writeAs in interface Writer
        Throws:
        java.io.IOException
      • writeObject

        public Writer writeObject​(java.lang.Object o,
                                  boolean cache)
                           throws java.io.IOException
        Specified by:
        writeObject in interface Writer
        Throws:
        java.io.IOException
      • writeObject

        public Writer writeObject​(java.lang.Object o)
                           throws java.io.IOException
        Specified by:
        writeObject in interface Writer
        Throws:
        java.io.IOException
      • writeCode

        public void writeCode​(int code)
                       throws java.io.IOException
        Throws:
        java.io.IOException
      • close

        public void close()
                   throws java.io.IOException
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
        Throws:
        java.io.IOException
      • beginClosedList

        public Writer beginClosedList()
                               throws java.io.IOException
        Description copied from interface: StreamingWriter
        Begin a variable-length closed list. This allows you (the writer) to write very large things, or things of unknown size, without having to place them in a collection first. However, you must remember to call endList when you are done, or the resulting stream will not be readable.
        Specified by:
        beginClosedList in interface StreamingWriter
        Returns:
        this Writer (fluent)
        Throws:
        java.io.IOException
      • endList

        public Writer endList()
                       throws java.io.IOException
        Description copied from interface: StreamingWriter
        Mark the end of a variable-lenght list, either closed or open.
        Specified by:
        endList in interface StreamingWriter
        Returns:
        this Writer (fluent)
        Throws:
        java.io.IOException
      • beginOpenList

        public Writer beginOpenList()
                             throws java.io.IOException
        Description copied from interface: StreamingWriter
        Begin a variable-length open list. An open list can be terminated either by a call to endList, *or* by an end of stream. Using an open is much more subtle than either a fixed or closed variable list. Avoid it if either other choice can work.
        Specified by:
        beginOpenList in interface StreamingWriter
        Returns:
        this Writer (fluent)
        Throws:
        java.io.IOException