@Override public void write(byte[] b, int off, int len) throws IOException { getDataOutputToWriteTo().write(b, off, len); }
/** * Add a message. * The order is: the message>id count>ids . * * @param ids The byte array which holds target ids * of this message on the worker * @param idPos The end position of the ids * information in the byte array above. * @param count The number of ids * @param msg The message sent */ public void add(byte[] ids, int idPos, int count, M msg) { try { msg.write(extendedDataOutput); extendedDataOutput.writeInt(count); extendedDataOutput.write(ids, 0, idPos); } catch (IOException e) { throw new IllegalStateException("add: IOException", e); } }
@Override public void add(byte[] serializedId, int idPos, T data) { try { extendedDataOutput.write(serializedId, 0, idPos); writeData(extendedDataOutput, data); } catch (IOException e) { throw new IllegalStateException("add: IOException", e); } }
@Override public void write(byte[] b) throws IOException { getDataOutputToWriteTo().write(b); }
@Override public void write(int b) throws IOException { getDataOutputToWriteTo().write(b); }
@Override public void add(byte[] serializedId, int idPos, M message) { if (!useMessageSizeEncoding) { super.add(serializedId, idPos, message); } else { try { extendedDataOutput.write(serializedId, 0, idPos); writeMessageWithSize(message); } catch (IOException e) { throw new IllegalStateException("add: IOException occurred"); } } }