//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: public static void marshal(org.neo4j.storageengine.api.WritableChannel writableChannel, TransactionRepresentationReplicatedTransaction replicatedTransaction) throws java.io.IOException public static void Marshal(WritableChannel writableChannel, TransactionRepresentationReplicatedTransaction replicatedTransaction) { if (writableChannel is ByteBufBacked) { /* * Marshals more efficiently if Channel is going over the network. In practice, this means maintaining support for * RaftV1 without loosing performance */ ByteBuf buffer = (( ByteBufBacked )writableChannel).byteBuf(); int metaDataIndex = buffer.writerIndex(); int txStartIndex = metaDataIndex + Integer.BYTES; // leave room for length to be set later. buffer.writerIndex(txStartIndex); WriteTx(writableChannel, replicatedTransaction.Tx()); int txLength = buffer.writerIndex() - txStartIndex; buffer.setInt(metaDataIndex, txLength); } else { /* * Unknown length. This should only be reached in tests. When a ReplicatedTransaction is marshaled to file it has already passed over the network * and is of a different type. More efficient marshalling is used in ByteArrayReplicatedTransaction. */ MemoryStream outputStream = new MemoryStream(1024); OutputStreamWritableChannel outputStreamWritableChannel = new OutputStreamWritableChannel(outputStream); WriteTx(outputStreamWritableChannel, replicatedTransaction.Tx()); int length = outputStream.size(); writableChannel.PutInt(length); writableChannel.Put(outputStream.toByteArray(), length); } }