Source:
protected Object decode(Channel channel, SocketAddress remoteAddress, Object msg) throws Exception { Parser parser = new Parser(PATTERN, (String) msg); if (!parser.matches()) { return null; } Position position = new Position(); position.setProtocol(getProtocolName()); position.set(Position.KEY_TYPE, parser.nextInt()); if (!identify(parser.next(), channel, remoteAddress)) { return null; } position.setDeviceId(getDeviceId()); DateBuilder dateBuilder = new DateBuilder() .setDateReverse(parser.nextInt(), parser.nextInt(), parser.nextInt()) .setTime(parser.nextInt(), parser.nextInt(), parser.nextInt()); position.setTime(dateBuilder.getDate()); if ("A".equals(parser.next())) { position.setValid(true); } else { position.setValid(false); } position.setLatitude(parser.nextCoordinate(CoordinateFormat.DEG_MIN_MIN_HEM)); position.setLongitude(parser.nextCoordinate(CoordinateFormat.DEG_MIN_MIN_HEM)); position.setSpeed(parser.nextDouble()); position.setCourse(parser.nextDouble()); position.set(Position.KEY_SATELLITES, parser.nextInt()); position.set(Position.KEY_GSM, parser.nextInt()); String vehicleStatus = parser.next(); position.set(Position.KEY_POWER, parser.nextInt()); position.set(Position.KEY_BATTERY, parser.nextDouble()); position.set(Position.KEY_ALARM, parser.nextInt()); Integer bodyTamper = parser.nextInt(); Integer acStatus = parser.nextInt(); position.set(Position.KEY_IGNITION, parser.nextInt()); position.set(Position.KEY_OUTPUT, parser.nextInt()); position.set(Position.PREFIX_ADC + 1, parser.nextInt()); position.set(Position.PREFIX_ADC + 2, parser.nextInt()); position.set(Position.KEY_VERSION, parser.next()); if ("R".equals(parser.next())) { position.set(Position.KEY_ARCHIVE, true); } else { position.set(Position.KEY_ARCHIVE, false); } String checksum = parser.next(); return position; }

Target:
protected Object decode(Channel channel, SocketAddress remoteAddress, Object msg) throws Exception { Parser parser = new Parser(PATTERN, (String) msg); if (!parser.matches()) { return null; } Position position = new Position(); position.setProtocol(getProtocolName()); position.set(Position.KEY_TYPE, parser.nextInt()); if (!identify(parser.next(), channel, remoteAddress)) { return null; } position.setDeviceId(getDeviceId()); DateBuilder dateBuilder = new DateBuilder() .setDateReverse(parser.nextInt(), parser.nextInt(), parser.nextInt()) .setTime(parser.nextInt(), parser.nextInt(), parser.nextInt()); position.setTime(dateBuilder.getDate()); if ("A".equals(parser.next())) { position.setValid(true); } else { position.setValid(false); } position.setLatitude(parser.nextCoordinate(CoordinateFormat.DEG_MIN_MIN_HEM)); position.setLongitude(parser.nextCoordinate(CoordinateFormat.DEG_MIN_MIN_HEM)); position.setSpeed(parser.nextDouble()); position.setCourse(parser.nextDouble()); position.set(Position.KEY_SATELLITES, parser.nextInt()); position.set(Position.KEY_GSM, parser.nextInt()); parser.next(); position.set(Position.KEY_POWER, parser.nextInt()); position.set(Position.KEY_BATTERY, parser.nextDouble()); position.set(Position.KEY_ALARM, parser.nextInt()); parser.nextInt(); parser.nextInt(); position.set(Position.KEY_IGNITION, parser.nextInt()); position.set(Position.KEY_OUTPUT, parser.nextInt()); position.set(Position.PREFIX_ADC + 1, parser.nextInt()); position.set(Position.PREFIX_ADC + 2, parser.nextInt()); position.set(Position.KEY_VERSION, parser.next()); position.set(Position.KEY_ARCHIVE, parser.next().equals("R")); parser.next(); return position; }