public byte[] getCachedBytes(int sizeLimit) throws LargeObjectException,MissingObjectException, IOException {if (!isLarge())return getCachedBytes();try (ObjectStream in = openStream()) {long sz = in.getSize();if (sizeLimit < sz)throw new LargeObjectException.ExceedsLimit(sizeLimit, sz);if (Integer.MAX_VALUE < sz)throw new LargeObjectException.ExceedsByteArrayLimit();byte[] buf;try {buf = new byte[(int) sz];} catch (OutOfMemoryError notEnoughHeap) {throw new LargeObjectException.OutOfMemory(notEnoughHeap);}IO.readFully(in, buf, 0, buf.length);return buf;}}
public virtual byte[] GetCachedBytes(int sizeLimit){if (!IsLarge()){return GetCachedBytes();}ObjectStream @in = OpenStream();try{long sz = @in.GetSize();if (sizeLimit < sz){throw new LargeObjectException.ExceedsLimit(sizeLimit, sz);}if (int.MaxValue < sz){throw new LargeObjectException.ExceedsByteArrayLimit();}byte[] buf;try{buf = new byte[(int)sz];}catch (OutOfMemoryException notEnoughHeap){throw new LargeObjectException.OutOfMemory(notEnoughHeap);}IOUtil.ReadFully(@in, buf, 0, buf.Length);return buf;}finally{@in.Close();}}