Example usage for com.lowagie.text.pdf RandomAccessFileOrArray InputStreamToArray

List of usage examples for com.lowagie.text.pdf RandomAccessFileOrArray InputStreamToArray

Introduction

In this page you can find the example usage for com.lowagie.text.pdf RandomAccessFileOrArray InputStreamToArray.

Prototype

public static byte[] InputStreamToArray(InputStream is) throws IOException 

Source Link

Usage

From source file:com.qubit.terra.docs.util.FontManager.java

License:Open Source License

protected FontEntry createFontEntry(File ttfFile)
        throws FontFormatException, IOException, FileNotFoundException, DocumentException {
    InputStream is = null;/*from w  ww .j av  a 2s  .  c o  m*/
    try {
        is = new FileInputStream(ttfFile);
        byte[] fontData = RandomAccessFileOrArray.InputStreamToArray(is);
        BaseFont baseFont = BaseFont.createFont(ttfFile.getName(), BaseFont.IDENTITY_H, BaseFont.EMBEDDED,
                false, fontData, null);
        FontEntry fontEntry = new FontEntry(ttfFile.getName(), baseFont);
        return fontEntry;
    } finally {
        if (is != null) {
            is.close();
        }
    }
}