aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2018-06-09 10:01:09 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2018-06-09 10:01:09 +1200
commit024d9cf87a058cf1e5923943af427cb8487abedb (patch)
treea128b4c006df11d70b18b00ae807c314c6cd5e95 /src
parent43ea9461037772d7754c0bac4f2756f43f3ecab7 (diff)
downloadtrackermap-server-024d9cf87a058cf1e5923943af427cb8487abedb.tar.gz
trackermap-server-024d9cf87a058cf1e5923943af427cb8487abedb.tar.bz2
trackermap-server-024d9cf87a058cf1e5923943af427cb8487abedb.zip
Improve buffer util
Diffstat (limited to 'src')
-rw-r--r--src/org/traccar/helper/BufferUtil.java8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/org/traccar/helper/BufferUtil.java b/src/org/traccar/helper/BufferUtil.java
index c046fcaf5..81a081182 100644
--- a/src/org/traccar/helper/BufferUtil.java
+++ b/src/org/traccar/helper/BufferUtil.java
@@ -33,10 +33,10 @@ public final class BufferUtil {
}
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);
}
}