示例#1
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private <T extends org.neo4j.bolt.messaging.RequestMessage> T serializeAndDeserialize(T msg) throws Exception
        private T SerializeAndDeserialize <T>(T msg) where T : Org.Neo4j.Bolt.messaging.RequestMessage
        {
            RecordingByteChannel channel = new RecordingByteChannel();

            Org.Neo4j.Bolt.messaging.Neo4jPack_Packer packer = _neo4jPack.newPacker(new BufferedChannelOutput(channel));
            BoltRequestMessageWriter writer = new BoltRequestMessageWriter(packer);

            writer.Write(msg).flush();
            channel.Eof();

            return(Unpack(channel));
        }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private <T extends org.neo4j.bolt.messaging.ResponseMessage> T serializeAndDeserialize(T msg) throws java.io.IOException
        private T SerializeAndDeserialize <T>(T msg) where T : Org.Neo4j.Bolt.messaging.ResponseMessage
        {
            RecordingByteChannel        channel = new RecordingByteChannel();
            BoltResponseMessageReader   reader  = new BoltResponseMessageReader(_neo4jPack.newUnpacker((new BufferedChannelInput(16)).reset(channel)));
            BufferedChannelOutput       output  = new BufferedChannelOutput(channel);
            BoltResponseMessageWriterV1 writer  = new BoltResponseMessageWriterV1(_neo4jPack.newPacker, output, NullLogService.Instance);

            writer.Write(msg);
            writer.Flush();

            channel.Eof();
            return(Unpack(reader, channel));
        }