Class PartFactory


  • class PartFactory
    extends ConsumerFactory
    The PartFactory represents a factory for creating the consumers that are used to read a multipart upload message. This supports two types of consumers for the multipart upload, lists and bodies. A part list is basically a collection of parts and or part lists. The part type is determined from the part header.
    See Also:
    PartSeriesConsumer, PartBodyConsumer
    • Field Detail

      • length

        private final long length
        This is the overall length of the parent part series.
    • Constructor Detail

      • PartFactory

        public PartFactory​(Allocator allocator,
                           Segment header,
                           long length)
        Constructor for the PartFactory object. This is used to create a factory using a buffer allocator, which will create a buffer for accumulating the entire message body, also to ensure the correct part type is created this requires the header information for the part.
        Parameters:
        allocator - this is used to allocate the internal buffer
        header - this is used to determine the part type
        length - this is the length of the parent part series
    • Method Detail

      • getInstance

        public BodyConsumer getInstance​(PartSeries series,
                                        byte[] boundary)
        This method is used to create the consumer given the list and boundary for the part. In order to determine the part type this will consult the header consumed for the part. Depending on whether it is a list or body a suitable consumer is created.
        Parameters:
        series - this is the list used to collect the parts
        boundary - this is the boundary used to terminate the part
        Returns:
        this will return the consumer for the part body