@Override public void write(DataOutput out) throws IOException { out.writeShort(THREE_LONGS); out.writeLong(pathHash); out.writeLong(modTime); out.writeLong(length); }
/** * write the bits to an output stream * * @param dataOut * @throws IOException */ public void writeToStream(DataOutput dataOut) throws IOException { dataOut.writeByte(length); if (length <= BYTE_SIZE) { dataOut.writeByte((byte)bits); } else if (length <= SHORT_SIZE) { dataOut.writeShort((short)bits); } else if (length <= INT_SIZE) { dataOut.writeInt((int)bits); } else { dataOut.writeLong(bits); } }
@Override public void toData(DataOutput out) throws IOException { DataSerializer.writeString(name, out); out.writeLong(length); out.writeInt(chunks); out.writeLong(created); out.writeLong(modified); out.writeLong(id.getMostSignificantBits()); out.writeLong(id.getLeastSignificantBits()); out.writeBoolean(possiblyRenamed); }
/** * Write this datagram to a random access file or data output stream. * * @param out * out * @throws IOException * IOException */ public void write(DataOutput out) throws IOException { out.writeLong(duration); out.writeInt(getLength()); for (int i = 0; i < quantizedCoeffs.length; i++) { out.writeShort(quantizedCoeffs[i]); } out.write(quantizedResidual); }
/** * Writes UUID to output stream. This method is meant to be used by * implementations of {@link Externalizable} interface. * * @param out Output stream. * @param uid UUID to write. * @throws IOException If write failed. */ public static void writeUuid(DataOutput out, UUID uid) throws IOException { // Write null flag. out.writeBoolean(uid == null); if (uid != null) { out.writeLong(uid.getMostSignificantBits()); out.writeLong(uid.getLeastSignificantBits()); } }
@Override public void visit(LongConstantInstruction insn) { try { output.writeByte(4); output.writeShort(insn.getReceiver().getIndex()); output.writeLong(insn.getConstant()); } catch (IOException e) { throw new IOExceptionWrapper(e); } }
public void writePayload(BTreeNode<Key,Value> node, DataOutput os) throws IOException { // Write the keys short count = (short)node.keys.length; // cast may truncate value... if( count != node.keys.length ) { throw new IOException("Too many keys"); } os.writeShort(count); for (int i = 0; i < node.keys.length; i++) { index.getKeyMarshaller().writePayload(node.keys[i], os); } if( node.isBranch() ) { // If this is a branch... os.writeBoolean(true); for (int i = 0; i < count+1; i++) { os.writeLong(node.children[i]); } } else { // If this is a leaf os.writeBoolean(false); for (int i = 0; i < count; i++) { index.getValueMarshaller().writePayload(node.values[i], os); } os.writeLong(node.next); } }
@Override public void writeTo(DataOutput out) throws Exception { if (ip_addr != null) { byte[] address = ip_addr.getAddress(); // 4 bytes (IPv4) or 16 bytes (IPv6) out.writeByte(address.length); // 1 byte out.write(address, 0, address.length); if (ip_addr instanceof Inet6Address) out.writeInt(((Inet6Address) ip_addr).getScopeId()); } else { out.writeByte(0); } out.writeShort(port); out.writeInt(vmViewId); out.writeLong(mostSigBits); out.writeLong(leastSigBits); }
@Override public void write(DataOutput out) throws IOException { out.writeLong(version); if (methods == null) { out.writeBoolean(false); } else { out.writeBoolean(true); out.writeInt(methods.length); for (int method : methods) { out.writeInt(method); } } }
/** * Write this datagram to a random access file or data output stream. * * @param out * out * @throws IOException * IOException */ public void write(DataOutput out) throws IOException { out.writeLong(duration); out.writeInt(getLength()); for (int i = 0; i < quantizedCoeffs.length; i++) { out.writeShort(quantizedCoeffs[i]); } out.write(quantizedResidual); }
@Override public void write(DataOutput out) throws IOException { super.write(out); out.writeBoolean(_isShrinked); if (_isShrinked) { out.writeLong(shrinkedLength); } } }
@Override public void write(DataOutput out) throws IOException { out.writeShort(THREE_LONGS); out.writeLong(pathHash); out.writeLong(modTime); out.writeLong(length); }
out.writeShort(rowLen); ByteBufferUtils.copyBufferToStream(out, ((ByteBufferExtendedCell) cell).getRowByteBuffer(), ((ByteBufferExtendedCell) cell).getRowPosition(), rowLen); out.writeByte(fLen); ByteBufferUtils.copyBufferToStream(out, ((ByteBufferExtendedCell) cell).getFamilyByteBuffer(), ((ByteBufferExtendedCell) cell).getFamilyPosition(), fLen); ((ByteBufferExtendedCell) cell).getQualifierPosition(), qLen); } else { out.writeShort(rowLen); out.write(cell.getRowArray(), cell.getRowOffset(), rowLen); out.writeByte(fLen); out.write(cell.getFamilyArray(), cell.getFamilyOffset(), fLen); out.write(cell.getQualifierArray(), cell.getQualifierOffset(), qLen); out.writeLong(cell.getTimestamp()); out.writeByte(cell.getTypeByte());
protected void writeId(DataOutput out, long id, byte idType) throws IOException { if (id < 0) { throw new IOException("id must not be negative " + id); } switch (idType) { case ID_ONE_BYTE: out.writeByte((byte) id + Byte.MIN_VALUE); break; case ID_TWO_BYTES: out.writeShort((short) id + Short.MIN_VALUE); break; case ID_FOUR_BYTES: out.writeInt((int) id + Integer.MIN_VALUE); break; case ID_EIGHT_BYTES: out.writeLong(id + Long.MIN_VALUE); break; default: throw new Error("Unknown idType " + idType); } }