Skip to content

Commit

Permalink
Improve buffer util
Browse files Browse the repository at this point in the history
  • Loading branch information
tananaev committed Jun 8, 2018
1 parent 43ea946 commit 024d9cf
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/org/traccar/helper/BufferUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ public static int indexOf(String needle, ByteBuf haystack) {
}

public static int indexOf(String needle, ByteBuf haystack, int startIndex, int endIndex) {
int index = ByteBufUtil.indexOf(
Unpooled.wrappedBuffer(needle.getBytes(StandardCharsets.US_ASCII)),
Unpooled.wrappedBuffer(haystack.array(), startIndex, endIndex - startIndex));
return (index != -1) ? (startIndex + index) : -1;
haystack = Unpooled.wrappedBuffer(haystack);
haystack.readerIndex(startIndex);
haystack.writerIndex(endIndex);
return indexOf(needle, haystack);
}

}

0 comments on commit 024d9cf

Please sign in to comment.