Class BasicBodyFactory.BinaryBody2

    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.nio.charset.Charset charset  
      private java.lang.String content  
    • Constructor Summary

      Constructors 
      Constructor Description
      BinaryBody2​(java.lang.String content, java.nio.charset.Charset charset)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      SingleBody copy()
      Returns a copy of this SingleBody (optional operation).
      void dispose()
      Subclasses should override this method if they have allocated resources that need to be freed explicitly (e.g.
      java.io.InputStream getInputStream()
      Gets a InputStream which reads the bytes of the body.
      • Methods inherited from class java.lang.Object

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

      • content

        private final java.lang.String content
      • charset

        private final java.nio.charset.Charset charset
    • Constructor Detail

      • BinaryBody2

        BinaryBody2​(java.lang.String content,
                    java.nio.charset.Charset charset)
    • Method Detail

      • getInputStream

        public java.io.InputStream getInputStream()
                                           throws java.io.IOException
        Description copied from class: SingleBody
        Gets a InputStream which reads the bytes of the body.
        Specified by:
        getInputStream in class SingleBody
        Returns:
        the stream, transfer decoded
        Throws:
        java.io.IOException - on I/O errors.
      • dispose

        public void dispose()
        Description copied from class: SingleBody
        Subclasses should override this method if they have allocated resources that need to be freed explicitly (e.g. cannot be simply reclaimed by the garbage collector). The default implementation of this method does nothing.
        Specified by:
        dispose in interface Disposable
        Overrides:
        dispose in class SingleBody
        See Also:
        Disposable.dispose()
      • copy

        public SingleBody copy()
        Description copied from class: SingleBody
        Returns a copy of this SingleBody (optional operation).

        The general contract of this method is as follows:

        • Invoking SingleBody.getParent() on the copy returns null. That means that the copy is detached from the parent entity of this SingleBody. The copy may get attached to a different entity later on.
        • The underlying content does not have to be copied. Instead it may be shared between multiple copies of a SingleBody.
        • If the underlying content is shared by multiple copies the implementation has to make sure that the content gets deleted when the last copy gets disposed of (and not before that).

        This implementation always throws an UnsupportedOperationException.

        Overrides:
        copy in class SingleBody
        Returns:
        a copy of this SingleBody.