| 753 | */ |
| 754 | // This is visible for testing. |
| 755 | List<byte[]> findAllUTF8(final byte[] b, int n) { |
| 756 | final List<byte[]> result = new ArrayList<byte[]>(); |
| 757 | allMatches( |
| 758 | MachineInput.fromUTF8(b), |
| 759 | n, |
| 760 | new DeliverFunc() { |
| 761 | @Override |
| 762 | public void deliver(int[] match) { |
| 763 | result.add(Utils.subarray(b, match[0], match[1])); |
| 764 | } |
| 765 | }); |
| 766 | if (result.isEmpty()) { |
| 767 | return null; |
| 768 | } |
| 769 | return result; |
| 770 | } |
| 771 | |
| 772 | /** |
| 773 | * {@code findAllUTF8Index} is the <a href='#all'>All</a> version of {@link #findUTF8Index}; it |