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)); } }
public OpenTypeParser(String name) throws java.io.IOException { String ttcName = getTTCName(name); this.fileName = ttcName; if (ttcName.length() < name.length()) { ttcIndex = Integer.parseInt(name.substring(ttcName.length() + 1)); } raf = new RandomAccessFileOrArray(new RandomAccessSourceFactory().createBestSource(fileName)); initializeSfntTables(); }
public OpenTypeParser(String name) throws java.io.IOException { String ttcName = getTTCName(name); this.fileName = ttcName; if (ttcName.length() < name.length()) { ttcIndex = Integer.parseInt(name.substring(ttcName.length() + 1)); } raf = new RandomAccessFileOrArray(new RandomAccessSourceFactory().createBestSource(fileName)); initializeSfntTables(); }
/** * Creates an independent view of this object (with it's own file pointer and push back queue). Closing the new object will not close this object. * Closing this object will have adverse effect on the view. * * @return the new view */ public RandomAccessFileOrArray createView() { ensureByteSourceIsThreadSafe(); return new RandomAccessFileOrArray(new IndependentRandomAccessSource(byteSource)); }
/** * 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)); }
/** * Creates an independent view of this object (with it's own file pointer and push back queue). Closing the new object will not close this object. * Closing this object will have adverse effect on the view. * * @return the new view */ public RandomAccessFileOrArray createView() { ensureByteSourceIsThreadSafe(); return new RandomAccessFileOrArray(new IndependentRandomAccessSource(byteSource)); }
/** 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(); }
public OpenTypeParser(String ttcPath, int ttcIndex) throws java.io.IOException { this.ttcIndex = ttcIndex; raf = new RandomAccessFileOrArray(new RandomAccessSourceFactory().createBestSource(ttcPath)); 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(String ttcPath, int ttcIndex) throws java.io.IOException { this.ttcIndex = ttcIndex; raf = new RandomAccessFileOrArray(new RandomAccessSourceFactory().createBestSource(ttcPath)); 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(); }
@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))); } }
public OpenTypeParser(byte[] ttf) throws java.io.IOException { raf = new RandomAccessFileOrArray(new RandomAccessSourceFactory().createSource(ttf)); 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(); }
static byte[] readFontBytesFromPath(String path) throws java.io.IOException { RandomAccessFileOrArray raf = new RandomAccessFileOrArray(new RandomAccessSourceFactory().createBestSource(path)); int bufLen = (int) raf.length(); if (bufLen < raf.length()) { throw new IOException(MessageFormatUtil.format("Source data from \"{0}\" is bigger than byte array can hold.", path)); } byte[] buf = new byte[bufLen]; raf.readFully(buf); return buf; } }
static byte[] readFontBytesFromPath(String path) throws java.io.IOException { RandomAccessFileOrArray raf = new RandomAccessFileOrArray(new RandomAccessSourceFactory().createBestSource(path)); int bufLen = (int) raf.length(); if (bufLen < raf.length()) { throw new IOException(MessageFormatUtil.format("Source data from \"{0}\" is bigger than byte array can hold.", path)); } byte[] buf = new byte[bufLen]; raf.readFully(buf); return buf; } }