本文整理汇总了Java中com.lowagie.text.Document.plainRandomAccess方法的典型用法代码示例。如果您正苦于以下问题:Java Document.plainRandomAccess方法的具体用法?Java Document.plainRandomAccess怎么用?Java Document.plainRandomAccess使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.lowagie.text.Document
的用法示例。
在下文中一共展示了Document.plainRandomAccess方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: process
import com.lowagie.text.Document; //导入方法依赖的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
* @since 2.1.5
*/
void process(byte ttfAfm[], boolean preload) throws DocumentException, IOException {
tables = new HashMap();
try {
if (ttfAfm == null)
rf = new RandomAccessFileOrArray(fileName, preload, Document.plainRandomAccess);
else
rf = new RandomAccessFileOrArray(ttfAfm);
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);
int ttId = rf.readInt();
if (ttId != 0x00010000 && ttId != 0x4F54544F)
throw new DocumentException(fileName + " is not a valid TTF or OTF file.");
int num_tables = rf.readUnsignedShort();
rf.skipBytes(6);
for (int k = 0; k < num_tables; ++k) {
String tag = readStandardString(4);
rf.skipBytes(4);
int table_location[] = new int[2];
table_location[0] = rf.readInt();
table_location[1] = rf.readInt();
tables.put(tag, table_location);
}
checkCff();
fontName = getBaseFont();
fullName = getNames(4); //full name
familyName = getNames(1); //family name
allNameEntries = getAllNames();
if (!justNames) {
fillTables();
readGlyphWidths();
readCMaps();
readKerning();
readBbox();
// GlyphWidths = null;
}
}
finally {
if (rf != null) {
rf.close();
if (!embedded)
rf = null;
}
}
}
示例2: RandomAccessFileOrArray
import com.lowagie.text.Document; //导入方法依赖的package包/类
public RandomAccessFileOrArray(String filename) throws IOException {
this(filename, false, Document.plainRandomAccess);
}