Java Code Examples for com.lowagie.text.pdf.RandomAccessFileOrArray#readInt()
The following examples show how to use
com.lowagie.text.pdf.RandomAccessFileOrArray#readInt() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TIFFDirectory.java From gcs with Mozilla Public License 2.0 | 5 votes |
private int readInt(RandomAccessFileOrArray stream) throws IOException { if (isBigEndian) { return stream.readInt(); } else { return stream.readIntLE(); } }
Example 2
Source File: TIFFDirectory.java From itext2 with GNU Lesser General Public License v3.0 | 5 votes |
private int readInt(RandomAccessFileOrArray stream) throws IOException { if (isBigEndian) { return stream.readInt(); } else { return stream.readIntLE(); } }
Example 3
Source File: TIFFDirectory.java From MesquiteCore with GNU Lesser General Public License v3.0 | 5 votes |
private int readInt(RandomAccessFileOrArray stream) throws IOException { if (isBigEndian) { return stream.readInt(); } else { return stream.readIntLE(); } }
Example 4
Source File: TrueTypeFont.java From birt with Eclipse Public License 1.0 | 4 votes |
/** * Reads the font data. * * @param ttfAfm * the font as a <CODE>byte</CODE> array, possibly <CODE>null</CODE> * @throws DocumentException * the font is invalid * @throws IOException * the font file could not be read */ void process( ) throws DocumentException, IOException { positionTables = new HashMap<String, int[]>( ); metadataTables = new HashMap<String, byte[]>( ); try { rf = new RandomAccessFileOrArray( fileName ); if ( ttcIndex.length( ) > 0 ) { int dirIdx = Integer.parseInt( ttcIndex ); if ( dirIdx < 0 ) throw new DocumentException( "The font index for " + fileName + " must be positive." ); String mainTag = readStandardString( 4 ); if ( !mainTag.equals( "ttcf" ) ) throw new DocumentException( fileName + " is not a valid TTC file." ); rf.skipBytes( 4 ); int dirCount = rf.readInt( ); if ( dirIdx >= dirCount ) throw new DocumentException( "The font index for " + fileName + " must be between 0 and " + ( dirCount - 1 ) + ". It was " + dirIdx + "." ); rf.skipBytes( dirIdx * 4 ); directoryOffset = rf.readInt( ); } rf.seek( directoryOffset ); rf.readFully( directoryRawData ); int ttId = Util.getInt( directoryRawData, 0 ); if ( ttId != 0x00010000 && ttId != 0x4F54544F ) throw new DocumentException( fileName + " is not a valid TTF or OTF file." ); int num_tables = Util.getUnsignedShort( directoryRawData, 4 ); for ( int k = 0; k < num_tables; ++k ) { byte[] rawData = new byte[16]; rf.readFully( rawData ); String tag = getStandardString( rawData, 0, 4 ); int table_location[] = new int[2]; table_location[0] = Util.getInt( rawData, 8 ); table_location[1] = Util.getInt( rawData, 12 ); positionTables.put( tag, table_location ); metadataTables.put( tag, rawData ); } fontName = getBaseFont( ); fullName = getNames( 4 ); // full name familyName = getNames( 1 ); // family name notice = getNames( 0 ); version = getNames( 5 ); if ( !justNames ) { fillTables( ); readGlyphWidths( ); readCMaps( ); readKerning( ); readBbox( ); GlyphWidths = null; } } finally { if ( rf != null ) { rf.close( ); if ( !embedded ) rf = null; } } }