public override BContentStream getStream(BTargetId targetId) { Dictionary<long, ByteBuffer> map = null; if (!mapStreams.TryGetValue(targetId.getMessageId(), out map)) throw new IOException("Stream not found."); ByteBuffer buf = null; if (!map.TryGetValue(targetId.getStreamId(), out buf)) throw new IOException("Stream not found."); return new BContentStreamWrapper(new MemoryStream(buf.array(), buf.position(), buf.remaining())); }
public override void write(Object obj, BOutput bout1, long version) { BOutputBin bout = ((BOutputBin)bout1); Stream strm = (Stream)obj; BContentStream bstream = bout.createStreamRequest(strm); BTargetId targetId = bstream.TargetId; bool withProps = bout1.header.bversion >= BMessageHeader.BYPS_VERSION_EXTENDED_STREAM_INFORMATION; if (withProps) { bstream.TargetId.write(bout.bbuf.getBuffer(), bout1.header.bversion); bout.bbuf.putLong(bstream.ContentLength); bout.bbuf.putString(bstream.ContentType); bout.bbuf.putInt(bstream.AttachmentCode); bout.bbuf.putString(bstream.FileName); } else { bout.bbuf.putLong(targetId.getStreamId()); } }
public RequestToCancel createRequestForGetStream(BTargetId targetId, BAsyncResultIF <BMessage> asyncResult) { RequestToCancel r = new RequestToCancel(this, ERequestDirection.FORWARD, targetId.getMessageId(), null, null, targetId.getStreamId(), 0L, timeoutMillisClient, timeoutMillisClient, asyncResult); addRequest(r); return(r); }