/// <exception cref="System.IO.IOException"/> public virtual int Read(ByteBuffer dst) { this._enclosing.refCount.Reference(); bool exc = true; try { int nread = 0; if (dst.IsDirect()) { nread = DomainSocket.ReadByteBufferDirect0(this._enclosing.fd, dst, dst.Position( ), dst.Remaining()); } else { if (dst.HasArray()) { nread = DomainSocket.ReadArray0(this._enclosing.fd, ((byte[])dst.Array()), dst.Position () + dst.ArrayOffset(), dst.Remaining()); } else { throw new Exception("we don't support " + "using ByteBuffers that aren't either direct or backed by " + "arrays"); } } if (nread > 0) { dst.Position(dst.Position() + nread); } exc = false; return(nread); } finally { this._enclosing.Unreference(exc); } }