/** * Obtain a copy of the bytes of this object. * <p> * Unlike {@link #getCachedBytes()} this method returns an array that might * be modified by the caller. * * @return the bytes of this object. * @throws org.eclipse.jgit.errors.LargeObjectException * if the object won't fit into a byte array, because * {@link #isLarge()} returns true. Callers should use * {@link #openStream()} instead to access the contents. */ public final byte[] getBytes() throws LargeObjectException { return cloneArray(getCachedBytes()); }
byte[] cached = getCachedBytes(sizeLimit); try { return cloneArray(cached); } catch (OutOfMemoryError tooBig) { throw new LargeObjectException.OutOfMemory(tooBig);
/** * Obtain a copy of the bytes of this object. * <p> * Unlike {@link #getCachedBytes()} this method returns an array that might * be modified by the caller. * * @return the bytes of this object. * @throws LargeObjectException * if the object won't fit into a byte array, because * {@link #isLarge()} returns true. Callers should use * {@link #openStream()} instead to access the contents. */ public final byte[] getBytes() throws LargeObjectException { return cloneArray(getCachedBytes()); }
/** * Obtain a copy of the bytes of this object. * <p> * Unlike {@link #getCachedBytes()} this method returns an array that might * be modified by the caller. * * @return the bytes of this object. * @throws org.eclipse.jgit.errors.LargeObjectException * if the object won't fit into a byte array, because * {@link #isLarge()} returns true. Callers should use * {@link #openStream()} instead to access the contents. */ public final byte[] getBytes() throws LargeObjectException { return cloneArray(getCachedBytes()); }
byte[] cached = getCachedBytes(sizeLimit); try { return cloneArray(cached); } catch (OutOfMemoryError tooBig) { throw new LargeObjectException.OutOfMemory(tooBig);
byte[] cached = getCachedBytes(sizeLimit); try { return cloneArray(cached); } catch (OutOfMemoryError tooBig) { throw new LargeObjectException.OutOfMemory(tooBig);