aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar/helper
diff options
context:
space:
mode:
authorAnton Tananaev <anton@traccar.org>2022-05-28 06:31:55 -0700
committerAnton Tananaev <anton@traccar.org>2022-05-28 06:31:55 -0700
commit56af285413c2337079332f303f7d091d65f09c4e (patch)
tree800c4b6c3f7a54b98a63451aea3183832c64947c /src/main/java/org/traccar/helper
parentbb50a4178d171d40734b94fccf52b72733f1f04c (diff)
downloadtrackermap-server-56af285413c2337079332f303f7d091d65f09c4e.tar.gz
trackermap-server-56af285413c2337079332f303f7d091d65f09c4e.tar.bz2
trackermap-server-56af285413c2337079332f303f7d091d65f09c4e.zip
Decode G6W audio format
Diffstat (limited to 'src/main/java/org/traccar/helper')
-rw-r--r--src/main/java/org/traccar/helper/BufferUtil.java12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/main/java/org/traccar/helper/BufferUtil.java b/src/main/java/org/traccar/helper/BufferUtil.java
index 9485c17c6..1e1a687fa 100644
--- a/src/main/java/org/traccar/helper/BufferUtil.java
+++ b/src/main/java/org/traccar/helper/BufferUtil.java
@@ -27,6 +27,18 @@ public final class BufferUtil {
private BufferUtil() {
}
+ public static int indexOf(ByteBuf buffer, int fromIndex, int toIndex, byte value, int count) {
+ int startIndex = fromIndex;
+ for (int i = 0; i < count; i++) {
+ int result = buffer.indexOf(startIndex, toIndex, value);
+ if (result < 0 || i == count - 1) {
+ return result;
+ }
+ startIndex = result + 1;
+ }
+ return -1;
+ }
+
public static int indexOf(String needle, ByteBuf haystack) {
return indexOf(needle, haystack, haystack.readerIndex(), haystack.writerIndex());
}