Class ODataBatchUtilities
java.lang.Object
org.apache.olingo.client.core.communication.request.batch.ODataBatchUtilities
Utility class for batch requests and responses.
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidaddHeaderLine(String headerLine, Map<String, Collection<String>> targetMap) Parses and adds the given header line to the given target map.static StringgetBoundaryFromHeader(Collection<String> contentType) Retrieved batch boundary from the given content-type header values.getItemType(Map<String, Collection<String>> headers) Retrieves item type from item headers.static Map<String,Collection<String>> nextItemHeaders(ODataBatchLineIterator iterator, String boundary) Retrieves headers of the next batch item.static StringreadBatchPart(ODataBatchController batchController, boolean checkCurrent) Reads batch part taking source and delimiter (boundary) from given batch controller.static StringreadBatchPart(ODataBatchController batchController, int count) Reads the given number of line from the given batch wrapped into the batch controller.static StringreadBatchPart(ODataBatchController controller, OutputStream os, boolean checkCurrent) Reads batch part taking source and delimiter (boundary) from given batch controller.static StringreadBatchPart(ODataBatchController controller, OutputStream os, int count, boolean checkCurrent) Reads batch part taking source and delimiter (boundary) from given batch controller.static Map<String,Collection<String>> readHeaders(ODataBatchLineIterator iterator) Reads headers from the batch starting from the given position.static voidreadHeaders(ODataBatchLineIterator iterator, Map<String, Collection<String>> target) Reads headers from the batch starting from the given position.readResponseLine(ODataBatchLineIterator iterator) Retrieves response line from the given position.
-
Constructor Details
-
ODataBatchUtilities
public ODataBatchUtilities()
-
-
Method Details
-
readBatchPart
Reads batch part taking source and delimiter (boundary) from given batch controller.Usually used to consume/discard useless lines.
- Parameters:
batchController- batch controller.checkCurrent- if 'TRUE' the current line will be included into the delimiter verification.- Returns:
- latest read line.
-
readBatchPart
Reads the given number of line from the given batch wrapped into the batch controller.Usually used to consume/discard useless lines.
- Parameters:
batchController- batch controller.count- number of batch line to be read.- Returns:
- latest read line.
-
readBatchPart
public static String readBatchPart(ODataBatchController controller, OutputStream os, boolean checkCurrent) Reads batch part taking source and delimiter (boundary) from given batch controller.Usually used to read an entire batch part.
- Parameters:
controller- batch controller.os- destination stream of batch part (null to discard).checkCurrent- if 'TRUE' the current line will be included into the delimiter verification.- Returns:
- latest read line.
-
readBatchPart
public static String readBatchPart(ODataBatchController controller, OutputStream os, int count, boolean checkCurrent) Reads batch part taking source and delimiter (boundary) from given batch controller.Usually used to read an entire batch part.
- Parameters:
controller- batch controller.os- destination stream of batch part (null to discard).count- number of batch line to be read.checkCurrent- if 'TRUE' the current line will be included into the delimiter verification.- Returns:
- latest read line.
-
readHeaders
Reads headers from the batch starting from the given position.- Parameters:
iterator- batch iterator.- Returns:
- Map of header name in header values.
-
readHeaders
public static void readHeaders(ODataBatchLineIterator iterator, Map<String, Collection<String>> target) Reads headers from the batch starting from the given position.Retrieved headers will be added to the map given by target parameter.
- Parameters:
iterator- batch iterator.target- destination of the retrieved headers.
-
addHeaderLine
Parses and adds the given header line to the given target map.- Parameters:
headerLine- header line to be added.targetMap- target map.
-
getBoundaryFromHeader
Retrieved batch boundary from the given content-type header values.- Parameters:
contentType- content-types.- Returns:
- batch boundary.
-
readResponseLine
Retrieves response line from the given position.- Parameters:
iterator- batch iterator.- Returns:
- retrieved response line.
-
nextItemHeaders
public static Map<String,Collection<String>> nextItemHeaders(ODataBatchLineIterator iterator, String boundary) Retrieves headers of the next batch item.- Parameters:
iterator- batch line iterator.boundary- batch boundary.- Returns:
- batch item headers.
-
getItemType
Retrieves item type from item headers.- Parameters:
headers- batch item headers.- Returns:
- batch item type.
-