Beispiel #1
0
        /// <exception cref="System.IO.IOException"/>
        public static void Write(java.nio.channels.WritableByteChannel outputChannel, Capnproto.MessageBuilder message)
        {
            java.nio.ByteBuffer[] segments = message.GetSegmentsForOutput();
            int tableSize = (segments.Length + 2) & (~1);

            java.nio.ByteBuffer table = java.nio.ByteBuffer.allocate(4 * tableSize);
            table.order(java.nio.ByteOrder.LITTLE_ENDIAN);
            table.putInt(0, segments.Length - 1);
            for (int i = 0; i < segments.Length; ++i)
            {
                table.putInt(4 * (i + 1), segments[i].limit() / 8);
            }
            //Any padding is already zeroed.
            while (table.hasRemaining())
            {
                outputChannel.Write(table);
            }
            foreach (java.nio.ByteBuffer buffer in segments)
            {
                while (buffer.hasRemaining())
                {
                    outputChannel.Write(buffer);
                }
            }
        }
Beispiel #2
0
 public override long transferTo(long arg0, long arg1, java.nio.channels.WritableByteChannel arg2)
 {
     global::MonoJavaBridge.JNIEnv @__env = global::MonoJavaBridge.JNIEnv.ThreadEnv;
     if (!IsClrObject)
     {
         return(@__env.CallLongMethod(this.JvmHandle, global::java.nio.channels.FileChannel_._transferTo14453, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0), global::MonoJavaBridge.JavaBridge.ConvertToValue(arg1), global::MonoJavaBridge.JavaBridge.ConvertToValue(arg2)));
     }
     else
     {
         return(@__env.CallNonVirtualLongMethod(this.JvmHandle, global::java.nio.channels.FileChannel_.staticClass, global::java.nio.channels.FileChannel_._transferTo14453, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0), global::MonoJavaBridge.JavaBridge.ConvertToValue(arg1), global::MonoJavaBridge.JavaBridge.ConvertToValue(arg2)));
     }
 }
Beispiel #3
0
 public BufferedOutputStreamWrapper(java.nio.channels.WritableByteChannel w)
 {
     this.inner = w;
     this.buf   = java.nio.ByteBuffer.allocate(8192);
 }
Beispiel #4
0
 public abstract long transferTo(long arg0, long arg1, java.nio.channels.WritableByteChannel arg2);
Beispiel #5
0
 /// <exception cref="System.IO.IOException"/>
 public static void WriteToUnbuffered(java.nio.channels.WritableByteChannel output, Capnproto.MessageBuilder message)
 {
     Capnproto.BufferedOutputStreamWrapper buffered = new Capnproto.BufferedOutputStreamWrapper(output);
     Write(buffered, message);
     buffered.Flush();
 }
Beispiel #6
0
 public OutputStreamAnonymousInnerClassHelper(java.nio.channels.WritableByteChannel ch)
 {
     this.Ch = ch;
 }