![]() Public void PutMappedResult(string view, string docId, string reduceKey, RavenJObject data)Įtag etag = uuidGenerator.CreateSequentialUuid(UuidType.MappedResults) Int byteRead = bufferedInput.Read(array4, 0, array4.Length) īufferedOutput.Write(array4, 0, array4.Length) īufferedOutput.Write(array4, 0, byteRead) ![]() Even when using this technique, this class still guarantees that the number of bytes cached (not yet written to the target stream or not yet consumed by the user) is never larger than the actual specified buffer size. The max size of this "shadow" buffer is limited as to not allocate it on the LOH. This is because we assume that memory copies are significantly faster than IO operations on the underlying stream (if this was not true, using buffering is never appropriate). However, it may use a temporary buffer of up to twice the size in order to combine several IO operations on the underlying stream into a single operation. ]]> This class will never cache more bytes than the max specified buffer size. * Either _writePos can be greater than 0, or _readLen & _readPos can be greater than zero, but neither can be greater than zero at the same time. * _readPos = _readLen = 0 means the read buffer contains garbage. The following should be true: 0 implies the read buffer is valid, but we're at the end of the buffer. It can only be used for one or the other at any point in time - not both. Class Invariants: The class has one buffer, shared for reading & writing. (If you maintained two buffers separately, one operation would always trash the other buffer anyways, so we might as well use one buffer.) The assumption here is you will almost always be doing a series of reads or writes, but rarely alternate between the two of them on the same stream. This class buffers reads & writes in a shared buffer. See a large comment in Write for the details of the write buffer heuristic. If you always read & write for sizes greater than the internal buffer size, then this class may not even allocate the internal buffer. ![]() One of the design goals here is to prevent the buffer from getting in the way and slowing down underlying stream accesses when it is not needed. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |