private static int readInt(InflaterInputStream inflaterInputStream) throws IOException { byte[] buffer = readBytes(inflaterInputStream, 4); ByteBuffer byteBuffer = ByteBuffer.wrap(buffer); return byteBuffer.getInt(); }
InflaterInputStream inflaterInputStream = new InflaterInputStream(new ByteArrayInputStream(data)); int dataVersionLength = readInt(inflaterInputStream); byte[] dataVersionBytes = readBytes(inflaterInputStream, dataVersionLength); DataVersion dataVersion = DataVersion.decode(dataVersionBytes, DataVersion.class); int topicConfigJsonLength = readInt(inflaterInputStream); byte[] buffer = readBytes(inflaterInputStream, topicConfigJsonLength); TopicConfig topicConfig = new TopicConfig(); String topicConfigJson = new String(buffer, MixAll.DEFAULT_CHARSET); byte[] filterServerListBuffer = readBytes(inflaterInputStream, filterServerListJsonLength); String filterServerListJson = new String(filterServerListBuffer, MixAll.DEFAULT_CHARSET); List<String> filterServerList = new ArrayList<String>();
private static int readInt(InflaterInputStream inflaterInputStream) throws IOException { byte[] buffer = readBytes(inflaterInputStream, 4); ByteBuffer byteBuffer = ByteBuffer.wrap(buffer); return byteBuffer.getInt(); }
InflaterInputStream inflaterInputStream = new InflaterInputStream(new ByteArrayInputStream(data)); int dataVersionLength = readInt(inflaterInputStream); byte[] dataVersionBytes = readBytes(inflaterInputStream, dataVersionLength); DataVersion dataVersion = DataVersion.decode(dataVersionBytes, DataVersion.class); int topicConfigJsonLength = readInt(inflaterInputStream); byte[] buffer = readBytes(inflaterInputStream, topicConfigJsonLength); TopicConfig topicConfig = new TopicConfig(); String topicConfigJson = new String(buffer, MixAll.DEFAULT_CHARSET); byte[] filterServerListBuffer = readBytes(inflaterInputStream, filterServerListJsonLength); String filterServerListJson = new String(filterServerListBuffer, MixAll.DEFAULT_CHARSET); List<String> filterServerList = new ArrayList<String>();