diff options
author | Abyss777 <abyss@fox5.ru> | 2018-06-08 17:04:44 +0500 |
---|---|---|
committer | Abyss777 <abyss@fox5.ru> | 2018-06-08 17:04:44 +0500 |
commit | c176b7b4bf4eef6f71767f92ada2591ef27c1cfa (patch) | |
tree | fd7ef0e30a4644760154ffc14101749311040d85 /src/org/traccar/protocol/TelicFrameDecoder.java | |
parent | ecb7bb33fcec52491f917dbc65a82990dcddb808 (diff) | |
download | trackermap-server-c176b7b4bf4eef6f71767f92ada2591ef27c1cfa.tar.gz trackermap-server-c176b7b4bf4eef6f71767f92ada2591ef27c1cfa.tar.bz2 trackermap-server-c176b7b4bf4eef6f71767f92ada2591ef27c1cfa.zip |
Migrate part of T protocols
Diffstat (limited to 'src/org/traccar/protocol/TelicFrameDecoder.java')
-rw-r--r-- | src/org/traccar/protocol/TelicFrameDecoder.java | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/src/org/traccar/protocol/TelicFrameDecoder.java b/src/org/traccar/protocol/TelicFrameDecoder.java index 245be28fb..b99ef98bf 100644 --- a/src/org/traccar/protocol/TelicFrameDecoder.java +++ b/src/org/traccar/protocol/TelicFrameDecoder.java @@ -1,5 +1,5 @@ /* - * Copyright 2016 Anton Tananaev (anton@traccar.org) + * Copyright 2016 - 2018 Anton Tananaev (anton@traccar.org) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,32 +15,33 @@ */ package org.traccar.protocol; -import org.jboss.netty.buffer.ChannelBuffer; -import org.jboss.netty.channel.Channel; -import org.jboss.netty.channel.ChannelHandlerContext; -import org.jboss.netty.handler.codec.frame.FrameDecoder; +import org.traccar.BaseFrameDecoder; -public class TelicFrameDecoder extends FrameDecoder { +import io.netty.buffer.ByteBuf; +import io.netty.channel.Channel; +import io.netty.channel.ChannelHandlerContext; + +public class TelicFrameDecoder extends BaseFrameDecoder { @Override protected Object decode( - ChannelHandlerContext ctx, Channel channel, ChannelBuffer buf) throws Exception { + ChannelHandlerContext ctx, Channel channel, ByteBuf buf) throws Exception { if (buf.readableBytes() < 4) { return null; } - long length = buf.getUnsignedInt(buf.readerIndex()); + long length = buf.getUnsignedIntLE(buf.readerIndex()); if (length < 1024) { if (buf.readableBytes() >= length + 4) { - buf.readUnsignedInt(); + buf.readUnsignedIntLE(); return buf.readBytes((int) length); } } else { int endIndex = buf.indexOf(buf.readerIndex(), buf.writerIndex(), (byte) 0); if (endIndex >= 0) { - ChannelBuffer frame = buf.readBytes(endIndex - buf.readerIndex()); + ByteBuf frame = buf.readBytes(endIndex - buf.readerIndex()); buf.readByte(); if (frame.readableBytes() > 0) { return frame; |