public CopyTo ( byte output, int offset, int length ) : int | ||
output | byte | |
offset | int | |
length | int | |
리턴 | int |
// Copy up to length of bytes from input directly. // This is used for uncompressed block. public int CopyFrom(InputBuffer input, int length) { length = Math.Min(Math.Min(length, WindowSize - _bytesUsed), input.AvailableBytes); int copied; // We might need wrap around to copy all bytes. int tailLen = WindowSize - _end; if (length > tailLen) { // copy the first part copied = input.CopyTo(_window, _end, tailLen); if (copied == tailLen) { // only try to copy the second part if we have enough bytes in input copied += input.CopyTo(_window, 0, length - tailLen); } } else { // only one copy is needed if there is no wrap around. copied = input.CopyTo(_window, _end, length); } _end = (_end + copied) & WindowMask; _bytesUsed += copied; return(copied); }
public int CopyFrom(InputBuffer input, int length) { int num; length = Math.Min(Math.Min(length, 0x8000 - this.bytesUsed), input.AvailableBytes); int num2 = 0x8000 - this.end; if (length > num2) { num = input.CopyTo(this.window, this.end, num2); if (num == num2) { num += input.CopyTo(this.window, 0, length - num2); } } else { num = input.CopyTo(this.window, this.end, length); } this.end = (this.end + num) & 0x7fff; this.bytesUsed += num; return num; }
public int CopyFrom(InputBuffer input, int length) { int num; length = Math.Min(Math.Min(length, 0x8000 - this.bytesUsed), input.AvailableBytes); int num2 = 0x8000 - this.end; if (length > num2) { num = input.CopyTo(this.window, this.end, num2); if (num == num2) { num += input.CopyTo(this.window, 0, length - num2); } } else { num = input.CopyTo(this.window, this.end, length); } this.end = (this.end + num) & 0x7fff; this.bytesUsed += num; return(num); }
// Copy up to length of bytes from input directly. // This is used for uncompressed block. public int CopyFrom(InputBuffer input, int length) { length = Math.Min(Math.Min(length, WindowSize - bytesUsed), input.AvailableBytes); int copied; // We might need wrap around to copy all bytes. int tailLen = WindowSize - end; if (length > tailLen) { // copy the first part copied = input.CopyTo(window, end, tailLen); if (copied == tailLen) { // only try to copy the second part if we have enough bytes in input copied += input.CopyTo(window, 0, length - tailLen); } } else { // only one copy is needed if there is no wrap around. copied = input.CopyTo(window, end, length); } end = (end + copied) & WindowMask; bytesUsed += copied; return copied; }