| 779 | */ |
| 780 | // This is visible for testing. |
| 781 | List<int[]> findAllUTF8Index(final byte[] b, int n) { |
| 782 | final List<int[]> result = new ArrayList<int[]>(); |
| 783 | allMatches( |
| 784 | MachineInput.fromUTF8(b), |
| 785 | n, |
| 786 | new DeliverFunc() { |
| 787 | @Override |
| 788 | public void deliver(int[] match) { |
| 789 | result.add(Utils.subarray(match, 0, 2)); |
| 790 | } |
| 791 | }); |
| 792 | if (result.isEmpty()) { |
| 793 | return null; |
| 794 | } |
| 795 | return result; |
| 796 | } |
| 797 | |
| 798 | /** |
| 799 | * {@code findAll} is the <a href='#all'>All</a> version of {@link #find}; it returns a list of up |