public final void writeLanguage(final ZippyBuffer writer, final boolean isExternal) throws IOException { if (isExternal) { writer.writeRawVarInt(45); } if (this.getInput() != null) { writer.writeRawVarInt(1); this.getInput().writeLangType(writer); } if (this.getOutput() != null) { writer.writeRawVarInt(2); this.getOutput().writeLangType(writer); } writer.writeRawVarInt(0); }
public static Language readLanguage(final ZippyBuffer reader) throws IOException { final Language packet = new Language(); int sector; while ((sector = reader.readSector()) != 0) { switch (sector) { case 1: packet.setInput(LangType.readLangType(reader)); break; case 2: packet.setOutput(LangType.readLangType(reader)); break; } } return packet; }