/** * Returns the underlying source. * * @return The underlying source * @throws IOException */ protected IRandomAccessSource getUnderlyingSource() throws IOException { RandomAccessSourceFactory fac = new RandomAccessSourceFactory(); return raf == null ? fac.createSource(bout) : fac.createSource(raf); }
/** * Returns the underlying source. * * @return The underlying source * @throws IOException */ protected IRandomAccessSource getUnderlyingSource() throws IOException { RandomAccessSourceFactory fac = new RandomAccessSourceFactory(); return raf == null ? fac.createSource(bout) : fac.createSource(raf); }
/** * Reads and parses a PDF document. * * @param is the {@code InputStream} containing the document. The stream is read to the * end but is not closed. * @param properties properties of the created reader * @throws IOException on error */ public PdfReader(InputStream is, ReaderProperties properties) throws IOException { this(new RandomAccessSourceFactory().createSource(is), properties); }
/** * Creates a {@link IRandomAccessSource} based on an {@link InputStream}. The full content of the InputStream is read into memory and used * as the source for the {@link IRandomAccessSource} * @param inputStream the stream to read from * @return the newly created {@link IRandomAccessSource} */ public IRandomAccessSource createSource(InputStream inputStream) throws java.io.IOException{ return createSource(StreamUtil.inputStreamToArray(inputStream)); }
/** * Creates a {@link IRandomAccessSource} based on an {@link InputStream}. The full content of the InputStream is read into memory and used * as the source for the {@link IRandomAccessSource} * @param inputStream the stream to read from * @return the newly created {@link IRandomAccessSource} */ public IRandomAccessSource createSource(InputStream inputStream) throws java.io.IOException{ return createSource(StreamUtil.inputStreamToArray(inputStream)); }
public RandomAccessFileOrArray getPostscriptBinary() throws java.io.IOException { if (pfbData != null) { return new RandomAccessFileOrArray(sourceFactory.createSource(pfbData)); } else if (pfbPath != null && pfbPath.toLowerCase().endsWith(".pfb")) { return new RandomAccessFileOrArray(sourceFactory.createBestSource(pfbPath)); } else { pfbPath = afmPath.substring(0, afmPath.length() - 3) + "pfb"; return new RandomAccessFileOrArray(sourceFactory.createBestSource(pfbPath)); } }
public RandomAccessFileOrArray getPostscriptBinary() throws java.io.IOException { if (pfbData != null) { return new RandomAccessFileOrArray(sourceFactory.createSource(pfbData)); } else if (pfbPath != null && pfbPath.toLowerCase().endsWith(".pfb")) { return new RandomAccessFileOrArray(sourceFactory.createBestSource(pfbPath)); } else { pfbPath = afmPath.substring(0, afmPath.length() - 3) + "pfb"; return new RandomAccessFileOrArray(sourceFactory.createBestSource(pfbPath)); } }
/** Gets the number of pages the TIFF document has. * @param bytes a byte array containing a TIFF image. * @return the number of pages. */ public static int getNumberOfPages(byte[] bytes) { IRandomAccessSource ras = new RandomAccessSourceFactory().createSource(bytes); return getNumberOfPages(new RandomAccessFileOrArray(ras)); }
/** * Gets the number of pages in a JBIG2 image. * @param bytes a byte array containing a JBIG2 image * @return the number of pages */ public static int getNumberOfPages(byte[] bytes) { IRandomAccessSource ras = new RandomAccessSourceFactory().createSource(bytes); return getNumberOfPages(new RandomAccessFileOrArray(ras)); }
/** Gets the number of pages the TIFF document has. * @param bytes a byte array containing a TIFF image. * @return the number of pages. */ public static int getNumberOfPages(byte[] bytes) { IRandomAccessSource ras = new RandomAccessSourceFactory().createSource(bytes); return getNumberOfPages(new RandomAccessFileOrArray(ras)); }
public OpenTypeParser(byte[] ttc, int ttcIndex) throws java.io.IOException { this.ttcIndex = ttcIndex; raf = new RandomAccessFileOrArray(new RandomAccessSourceFactory().createSource(ttc)); initializeSfntTables(); }
/** * Creates a new {@link TrueTypeCollection} instance by its bytes. * * @param ttc the byte contents of the collection * @throws java.io.IOException in case the input in mal-formatted */ public TrueTypeCollection(byte[] ttc) throws java.io.IOException { raf = new RandomAccessFileOrArray(new RandomAccessSourceFactory().createSource(ttc)); this.ttc = ttc; initFontSize(); }
public OpenTypeParser(byte[] ttf) throws java.io.IOException { raf = new RandomAccessFileOrArray(new RandomAccessSourceFactory().createSource(ttf)); initializeSfntTables(); }
/** * Creates a new {@link TrueTypeCollection} instance by its bytes. * * @param ttc the byte contents of the collection * @throws java.io.IOException in case the input in mal-formatted */ public TrueTypeCollection(byte[] ttc) throws java.io.IOException { raf = new RandomAccessFileOrArray(new RandomAccessSourceFactory().createSource(ttc)); this.ttc = ttc; initFontSize(); }
public OpenTypeParser(byte[] ttf) throws java.io.IOException { raf = new RandomAccessFileOrArray(new RandomAccessSourceFactory().createSource(ttf)); initializeSfntTables(); }
public OpenTypeParser(byte[] ttc, int ttcIndex) throws java.io.IOException { this.ttcIndex = ttcIndex; raf = new RandomAccessFileOrArray(new RandomAccessSourceFactory().createSource(ttc)); initializeSfntTables(); }
/** * Load data from URL. url must be not null. * Note, this method doesn't check if data or url is null. * @throws java.io.IOException */ void loadData() throws java.io.IOException { RandomAccessFileOrArray raf = new RandomAccessFileOrArray(new RandomAccessSourceFactory().createSource(url)); ByteArrayOutputStream stream = new ByteArrayOutputStream(); StreamUtil.transferBytes(raf, stream); raf.close(); data = stream.toByteArray(); }
/** * Load data from URL. url must be not null. * Note, this method doesn't check if data or url is null. * @throws java.io.IOException */ void loadData() throws java.io.IOException { RandomAccessFileOrArray raf = new RandomAccessFileOrArray(new RandomAccessSourceFactory().createSource(url)); ByteArrayOutputStream stream = new ByteArrayOutputStream(); StreamUtil.transferBytes(raf, stream); raf.close(); data = stream.toByteArray(); }
@Override public PdfTokenizer getLocation(String location) throws java.io.IOException { String fullName = FontResources.CMAPS + location; InputStream inp = ResourceUtil.getResourceStream(fullName); if (inp == null) { throw new IOException(IOException.Cmap1WasNotFound).setMessageParams(fullName); } return new PdfTokenizer(new RandomAccessFileOrArray(new RandomAccessSourceFactory().createSource(inp))); } }
@Override public PdfTokenizer getLocation(String location) throws java.io.IOException { String fullName = FontResources.CMAPS + location; InputStream inp = ResourceUtil.getResourceStream(fullName); if (inp == null) { throw new IOException(IOException.Cmap1WasNotFound).setMessageParams(fullName); } return new PdfTokenizer(new RandomAccessFileOrArray(new RandomAccessSourceFactory().createSource(inp))); } }