/** * Creates a {@link IRandomAccessSource} based on a byte array * @param data the byte array * @return the newly created {@link IRandomAccessSource} */ public IRandomAccessSource createSource(byte[] data){ return new ArrayRandomAccessSource(data); }
/** * Creates a {@link IRandomAccessSource} based on a byte array * @param data the byte array * @return the newly created {@link IRandomAccessSource} */ public IRandomAccessSource createSource(byte[] data){ return new ArrayRandomAccessSource(data); }
/** * Creates a new {@link IRandomAccessSource} by reading the specified file/resource into memory * @param stream the name of the resource to read * @return the newly created {@link IRandomAccessSource} * @throws java.io.IOException if reading the underling file or stream fails */ private IRandomAccessSource createByReadingToMemory(InputStream stream) throws java.io.IOException { try { return new ArrayRandomAccessSource(StreamUtil.inputStreamToArray(stream)); } finally { try { stream.close(); } catch (java.io.IOException ignored) { } } }
/** * Creates a new {@link IRandomAccessSource} by reading the specified file/resource into memory * @param stream the name of the resource to read * @return the newly created {@link IRandomAccessSource} * @throws java.io.IOException if reading the underling file or stream fails */ private IRandomAccessSource createByReadingToMemory(InputStream stream) throws java.io.IOException { try { return new ArrayRandomAccessSource(StreamUtil.inputStreamToArray(stream)); } finally { try { stream.close(); } catch (java.io.IOException ignored) { } } }