Fixes #4892 - Non-blocking JSON parser.

Added parse(byte[], int, int).

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
This commit is contained in:
Simone Bordet 2020-05-20 16:14:05 +02:00
parent 9ad7ff795e
commit e588a1bd9d
1 changed files with 16 additions and 1 deletions

View File

@ -203,10 +203,25 @@ public class AsyncJSON
*
* @param bytes the bytes to parse
* @return whether the JSON parsing was complete
* @throws IllegalArgumentException if the JSON is malformed
*/
public boolean parse(byte[] bytes)
{
return parse(ByteBuffer.wrap(bytes));
return parse(bytes, 0, bytes.length);
}
/**
* <p>Feeds the parser with the given bytes chunk.</p>
*
* @param bytes the bytes to parse
* @param offset the offset to start parsing from
* @param length the number of bytes to parse
* @return whether the JSON parsing was complete
* @throws IllegalArgumentException if the JSON is malformed
*/
public boolean parse(byte[] bytes, int offset, int length)
{
return parse(ByteBuffer.wrap(bytes, offset, length));
}
/**