当前位置: 首页>>代码示例>>Java>>正文


Java RandomAccessFileOrArray.readInt方法代码示例

本文整理汇总了Java中com.lowagie.text.pdf.RandomAccessFileOrArray.readInt方法的典型用法代码示例。如果您正苦于以下问题:Java RandomAccessFileOrArray.readInt方法的具体用法?Java RandomAccessFileOrArray.readInt怎么用?Java RandomAccessFileOrArray.readInt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.lowagie.text.pdf.RandomAccessFileOrArray的用法示例。


在下文中一共展示了RandomAccessFileOrArray.readInt方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: readInt

import com.lowagie.text.pdf.RandomAccessFileOrArray; //导入方法依赖的package包/类
private int readInt(RandomAccessFileOrArray stream)
throws IOException {
    if (isBigEndian) {
        return stream.readInt();
    } else {
        return stream.readIntLE();
    }
}
 
开发者ID:albfernandez,项目名称:itext2,代码行数:9,代码来源:TIFFDirectory.java

示例2: process

import com.lowagie.text.pdf.RandomAccessFileOrArray; //导入方法依赖的package包/类
/**
 * 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;
		}
	}
}
 
开发者ID:eclipse,项目名称:birt,代码行数:82,代码来源:TrueTypeFont.java


注:本文中的com.lowagie.text.pdf.RandomAccessFileOrArray.readInt方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。