org.springframework.batch.item.file.separator
Class JsonRecordSeparatorPolicy
java.lang.Object
org.springframework.batch.item.file.separator.SimpleRecordSeparatorPolicy
org.springframework.batch.item.file.separator.JsonRecordSeparatorPolicy
- All Implemented Interfaces:
- RecordSeparatorPolicy
public class JsonRecordSeparatorPolicy
- extends SimpleRecordSeparatorPolicy
JSON-based record separator. Waits for a valid JSON object before returning a
complete line. A valid object has balanced braces ({}), possibly nested, and
ends with a closing brace. This separator can be used to split a stream into
JSON objects, even if those objects are spread over multiple lines, e.g.
{"foo": "bar",
"value": { "spam": 2 }}
{"foo": "rab",
"value": { "spam": 3, "foo": "bar" }}
- Author:
- Dave Syer
Method Summary |
boolean |
isEndOfRecord(String line)
True if the line can be parsed to a JSON object. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
JsonRecordSeparatorPolicy
public JsonRecordSeparatorPolicy()
isEndOfRecord
public boolean isEndOfRecord(String line)
- True if the line can be parsed to a JSON object.
- Specified by:
isEndOfRecord
in interface RecordSeparatorPolicy
- Overrides:
isEndOfRecord
in class SimpleRecordSeparatorPolicy
- Parameters:
line
- a String without a newline character at the end.
- Returns:
- true if this line is the end of a record.
- See Also:
RecordSeparatorPolicy.isEndOfRecord(String)
Copyright © 2013 SpringSource. All Rights Reserved.