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(); }
/** * Reads and parses a PDF document. * * @param filename the file name of the document * @param properties properties of the created reader * @throws IOException on error */ public PdfReader(String filename, ReaderProperties properties) throws IOException { this( new RandomAccessSourceFactory() .setForceRead(false) .createBestSource(filename), properties ); this.sourcePath = filename; }
/** * This method is invoked while deserialization */ private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException { in.defaultReadObject(); if (sourcePath != null && tokens == null) { tokens = getOffsetTokeniser(new RandomAccessSourceFactory().setForceRead(false).createBestSource(sourcePath)); } }
return createBestSource(raf.getChannel()); } catch (java.io.IOException e){ if (exceptionIsMapFailureException(e)) {
return createBestSource(raf.getChannel()); } catch (java.io.IOException e){ if (exceptionIsMapFailureException(e)) {
public OpenTypeParser(String ttcPath, int ttcIndex) throws java.io.IOException { this.ttcIndex = ttcIndex; raf = new RandomAccessFileOrArray(new RandomAccessSourceFactory().createBestSource(ttcPath)); initializeSfntTables(); }
public OpenTypeParser(String ttcPath, int ttcIndex) throws java.io.IOException { this.ttcIndex = ttcIndex; raf = new RandomAccessFileOrArray(new RandomAccessSourceFactory().createBestSource(ttcPath)); initializeSfntTables(); }
/** * Construct an icc profile from the file found at the passed path * * @param filename path to the file contaning the profile * @return IccProfile constructed from the data * @throws IOException if the source does not contain a valid icc profile */ public static IccProfile getInstance(String filename) { RandomAccessFileOrArray raf; try { raf = new RandomAccessFileOrArray( new RandomAccessSourceFactory().createBestSource(filename)); } catch (java.io.IOException e) { throw new com.itextpdf.io.IOException(IOException.InvalidIccProfile, e); } return getInstance(raf); }
/** * Construct an icc profile from the file found at the passed path * * @param filename path to the file contaning the profile * @return IccProfile constructed from the data * @throws IOException if the source does not contain a valid icc profile */ public static IccProfile getInstance(String filename) { RandomAccessFileOrArray raf; try { raf = new RandomAccessFileOrArray( new RandomAccessSourceFactory().createBestSource(filename)); } catch (java.io.IOException e) { throw new com.itextpdf.io.IOException(IOException.InvalidIccProfile, e); } return getInstance(raf); }
} else if (afmPath != null) { if (afmPath.toLowerCase().endsWith(".afm")) { return new RandomAccessFileOrArray(sourceFactory.createBestSource(afmPath)); } else if (afmPath.toLowerCase().endsWith(".pfm")) { ByteArrayOutputStream ba = new ByteArrayOutputStream(); RandomAccessFileOrArray rf = new RandomAccessFileOrArray(sourceFactory.createBestSource(afmPath)); Pfm2afm.convert(rf, ba); rf.close();
} else if (afmPath != null) { if (afmPath.toLowerCase().endsWith(".afm")) { return new RandomAccessFileOrArray(sourceFactory.createBestSource(afmPath)); } else if (afmPath.toLowerCase().endsWith(".pfm")) { ByteArrayOutputStream ba = new ByteArrayOutputStream(); RandomAccessFileOrArray rf = new RandomAccessFileOrArray(sourceFactory.createBestSource(afmPath)); Pfm2afm.convert(rf, ba); rf.close();
/** * Creates a new {@link TrueTypeCollection} instance by its file path. * * @param ttcPath the path of the collection * @throws java.io.IOException in case the input in mal-formatted */ public TrueTypeCollection(String ttcPath) throws java.io.IOException { if (!FileUtil.fileExists(ttcPath)) { throw new IOException(IOException.FontFile1NotFound).setMessageParams(ttcPath); } raf = new RandomAccessFileOrArray(new RandomAccessSourceFactory().createBestSource(ttcPath)); this.ttcPath = ttcPath; initFontSize(); }
/** * Creates a new {@link TrueTypeCollection} instance by its file path. * * @param ttcPath the path of the collection * @throws java.io.IOException in case the input in mal-formatted */ public TrueTypeCollection(String ttcPath) throws java.io.IOException { if (!FileUtil.fileExists(ttcPath)) { throw new IOException(IOException.FontFile1NotFound).setMessageParams(ttcPath); } raf = new RandomAccessFileOrArray(new RandomAccessSourceFactory().createBestSource(ttcPath)); this.ttcPath = ttcPath; initFontSize(); }
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; } }