iTextSharp.text.io.StreamUtil.CopyBytes C# (CSharp) Метод

CopyBytes() публичный статический Метод

public static CopyBytes ( IRandomAccessSource source, long start, long length, Stream outs ) : void
source IRandomAccessSource
start long
length long
outs Stream
Результат void
        public static void CopyBytes(IRandomAccessSource source, long start, long length, Stream outs) {
            if (length <= 0)
                return;
            long idx = start;
            byte[] buf = new byte[8192];
            while (length > 0) {
                long n = source.Get(idx, buf,0, (int)Math.Min((long)buf.Length, length));
                if (n <= 0)
                    throw new EndOfStreamException();
                outs.Write(buf, 0, (int)n);
                idx += n;
                length -= n;
            }
        }