Package org.simpleframework.http.message
Class PartFactory
- java.lang.Object
-
- org.simpleframework.http.message.ConsumerFactory
-
- org.simpleframework.http.message.PartFactory
-
class PartFactory extends ConsumerFactory
ThePartFactory
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 Summary
Fields Modifier and Type Field Description private long
length
This is the overall length of the parent part series.-
Fields inherited from class org.simpleframework.http.message.ConsumerFactory
allocator, segment
-
-
Constructor Summary
Constructors Constructor Description PartFactory(Allocator allocator, Segment header, long length)
Constructor for thePartFactory
object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description BodyConsumer
getInstance(PartSeries series, byte[] boundary)
This method is used to create the consumer given the list and boundary for the part.-
Methods inherited from class org.simpleframework.http.message.ConsumerFactory
getBoundary, getContentLength, getInstance, getInstance, isChunked, isFixed, isUpload
-
-
-
-
Constructor Detail
-
PartFactory
public PartFactory(Allocator allocator, Segment header, long length)
Constructor for thePartFactory
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 bufferheader
- this is used to determine the part typelength
- 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 partsboundary
- this is the boundary used to terminate the part- Returns:
- this will return the consumer for the part body
-
-