//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldNotCountBytesAlreadyInBuffer() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldNotCountBytesAlreadyInBuffer() { // Given int sizeLimit = 100; ByteBuf buffer = Unpooled.buffer(); int padding = Long.BYTES; buffer.writeLong(0); BoundedNetworkWritableChannel channel = new BoundedNetworkWritableChannel(buffer, sizeLimit); // When for (int i = 0; i < sizeLimit - padding; i++) { channel.Put(( sbyte )0); } // then it should be ok // again, when for (int i = 0; i < padding; i++) { channel.Put(( sbyte )0); } // then again, it should work // finally, when we pass the limit try { channel.Put(( sbyte )0); fail("Should not allow more bytes than what the limit dictates"); } catch (MessageTooBigException) { // then } }
internal static ByteBuf SerializeTerms(RaftLogEntry[] raftLogEntries, ByteBufAllocator byteBufAllocator) { int capacity = (sizeof(sbyte) * 8) + (sizeof(int) * 8) + (sizeof(long) * 8) * raftLogEntries.Length; ByteBuf buffer = byteBufAllocator.buffer(capacity, capacity); buffer.writeByte(ContentType.RaftLogEntryTerms.get()); buffer.writeInt(raftLogEntries.Length); foreach (RaftLogEntry raftLogEntry in raftLogEntries) { buffer.writeLong(raftLogEntry.Term()); } return(buffer); }
protected internal override void Encode(ChannelHandlerContext ctx, TxStreamFinishedResponse response, ByteBuf @out) { @out.writeInt(response.Status().ordinal()); @out.writeLong(response.LatestTxId()); }
public override WritableChannel PutLong(long value) { @delegate.writeLong(value); return(this); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: protected void encode(io.netty.channel.ChannelHandlerContext ctx, TxPullRequest request, io.netty.buffer.ByteBuf out) throws Exception protected internal override void Encode(ChannelHandlerContext ctx, TxPullRequest request, ByteBuf @out) { @out.writeLong(request.PreviousTxId()); StoreIdMarshal.INSTANCE.marshal(request.ExpectedStoreId(), new BoundedNetworkWritableChannel(@out)); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: public org.neo4j.storageengine.api.WritableChannel putLong(long value) throws MessageTooBigException public override WritableChannel PutLong(long value) { CheckSize(Long.BYTES); @delegate.writeLong(value); return(this); }