@Override public void close() throws java.io.IOException { if (raf != null) { raf.close(); } raf = null; }
@Override public void close() throws java.io.IOException { if (raf != null) { raf.close(); } raf = null; }
public void close() throws java.io.IOException { if (closeStream) file.close(); }
public void close() throws java.io.IOException { if (closeStream) file.close(); }
public byte[] getFullFont() throws java.io.IOException { RandomAccessFileOrArray rf2 = null; try { rf2 = raf.createView(); byte[] b = new byte[(int) rf2.length()]; rf2.readFully(b); return b; } finally { try { if (rf2 != null) { rf2.close(); } } catch (Exception ignored) { } } }
public byte[] getFullFont() throws java.io.IOException { RandomAccessFileOrArray rf2 = null; try { rf2 = raf.createView(); byte[] b = new byte[(int) rf2.length()]; rf2.readFully(b); return b; } finally { try { if (rf2 != null) { rf2.close(); } } catch (Exception ignored) { } } }
} finally { try { buf.close(); } catch (Exception e) {
/** * If this font file is using the Compact Font File Format, then this method * will return the raw bytes needed for the font stream. If this method is * ever made public: make sure to add a test if (cff == true). * * @return a byte array */ public byte[] readCffFont() throws java.io.IOException { if (!isCff()) { return null; } RandomAccessFileOrArray rf2 = null; try { rf2 = raf.createView(); rf2.seek(cffOffset); byte[] cff = new byte[cffLength]; rf2.readFully(cff); return cff; } finally { try { if (rf2 != null) { rf2.close(); } } catch (Exception ignored) { } } }
} finally { try { buf.close(); } catch (Exception e) {
/** * If this font file is using the Compact Font File Format, then this method * will return the raw bytes needed for the font stream. If this method is * ever made public: make sure to add a test if (cff == true). * * @return a byte array */ public byte[] readCffFont() throws java.io.IOException { if (!isCff()) { return null; } RandomAccessFileOrArray rf2 = null; try { rf2 = raf.createView(); rf2.seek(cffOffset); byte[] cff = new byte[cffLength]; rf2.readFully(cff); return cff; } finally { try { if (rf2 != null) { rf2.close(); } } catch (Exception ignored) { } } }
RandomAccessFileOrArray rf = new RandomAccessFileOrArray(sourceFactory.createBestSource(afmPath)); Pfm2afm.convert(rf, ba); rf.close(); return new RandomAccessFileOrArray(sourceFactory.createSource(ba.toByteArray())); } else { throw new IOException("Invalid afm or pfm font file."); } finally { rf.close();
/** * 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(); }
/** * Does the actual work of subsetting the font. * * @return the subset font * @throws java.io.IOException on error * @on error */ byte[] process() throws java.io.IOException { try { createTableDirectory(); readLoca(); flatGlyphs(); createNewGlyphTables(); locaToBytes(); assembleFont(); return outFont; } finally { try { rf.close(); } catch (Exception ignore) { } } }
/** * Does the actual work of subsetting the font. * * @return the subset font * @throws java.io.IOException on error * @on error */ byte[] process() throws java.io.IOException { try { createTableDirectory(); readLoca(); flatGlyphs(); createNewGlyphTables(); locaToBytes(); assembleFont(); return outFont; } finally { try { rf.close(); } catch (Exception ignore) { } } }
/** * Processes the ImageData as a TIFF image. * @param image image to process. */ public static void processImage(ImageData image) { if (image.getOriginalType() != ImageType.TIFF) throw new IllegalArgumentException("TIFF image expected"); try { IRandomAccessSource ras; if (image.getData() == null) { image.loadData(); } ras = new RandomAccessSourceFactory().createSource(image.getData()); RandomAccessFileOrArray raf = new RandomAccessFileOrArray(ras); TiffParameters tiff = new TiffParameters((TiffImageData)image); processTiffImage(raf, tiff); raf.close(); if (!tiff.jpegProcessing) { RawImageHelper.updateImageAttributes(tiff.image, tiff.additional); } } catch (java.io.IOException e) { throw new IOException(IOException.TiffImageException, e); } }
/** * Processes the ImageData as a TIFF image. * @param image image to process. */ public static void processImage(ImageData image) { if (image.getOriginalType() != ImageType.TIFF) throw new IllegalArgumentException("TIFF image expected"); try { IRandomAccessSource ras; if (image.getData() == null) { image.loadData(); } ras = new RandomAccessSourceFactory().createSource(image.getData()); RandomAccessFileOrArray raf = new RandomAccessFileOrArray(ras); TiffParameters tiff = new TiffParameters((TiffImageData)image); processTiffImage(raf, tiff); raf.close(); if (!tiff.jpegProcessing) { RawImageHelper.updateImageAttributes(tiff.image, tiff.additional); } } catch (java.io.IOException e) { throw new IOException(IOException.TiffImageException, e); } }
sr.read(); Jbig2SegmentReader.Jbig2Page p = sr.getPage(image.getPage()); raf.close();
sr.read(); Jbig2SegmentReader.Jbig2Page p = sr.getPage(image.getPage()); raf.close();
file.close(); } catch (Exception ignored) {