internal static byte[] GetBuffer(DefiniteLengthInputStream defIn, byte[][] tmpBuffers) { int remaining = defIn.GetRemaining(); if (remaining >= tmpBuffers.Length) { return(defIn.ToArray()); } byte[] buf = tmpBuffers[remaining]; if (buf == null) { buf = tmpBuffers[remaining] = new byte[remaining]; } defIn.ReadAllIntoByteArray(buf); return(buf); }
private static byte[] GetBuffer(DefiniteLengthInputStream defIn, byte[][] tmpBuffers) { int len = defIn.Remaining; if (len >= tmpBuffers.Length) { return(defIn.ToArray()); } byte[] buf = tmpBuffers[len]; if (buf == null) { buf = tmpBuffers[len] = new byte[len]; } defIn.ReadAllIntoByteArray(buf); return(buf); }
internal static byte[] GetBuffer(DefiniteLengthInputStream defIn, byte[][] tmpBuffers) { int len = defIn.GetRemaining(); if (len >= tmpBuffers.Length) { return defIn.ToArray(); } byte[] buf = tmpBuffers[len]; if (buf == null) { buf = tmpBuffers[len] = new byte[len]; } defIn.ReadAllIntoByteArray(buf); return buf; }