proj_name stringclasses 131
values | relative_path stringlengths 30 228 | class_name stringlengths 1 68 | func_name stringlengths 1 48 | masked_class stringlengths 78 9.82k | func_body stringlengths 46 9.61k | len_input int64 29 2.01k | len_output int64 14 1.94k | total int64 55 2.05k | relevant_context stringlengths 0 38.4k |
|---|---|---|---|---|---|---|---|---|---|
LibrePDF_OpenPDF | OpenPDF/openpdf/src/main/java/com/lowagie/text/pdf/PRIndirectReference.java | PRIndirectReference | toPdf | class PRIndirectReference extends PdfIndirectReference {
protected PdfReader reader;
// membervariables
// constructors
/**
* Constructs a <CODE>PdfIndirectReference</CODE>.
*
* @param reader a <CODE>PdfReader</CODE>
* @param number the object number.
* @param generat... |
int n = writer.getNewObjectNumber(reader, number, generation);
os.write(PdfEncodings.convertToBytes(new StringBuffer().append(n).append(" 0 R").toString(), null));
| 341 | 55 | 396 | <methods>public int getGeneration() ,public int getNumber() ,public java.lang.String toString() <variables>protected int generation,protected int number |
LibrePDF_OpenPDF | OpenPDF/openpdf/src/main/java/com/lowagie/text/pdf/PRStream.java | PRStream | setData | class PRStream extends PdfStream {
protected PdfReader reader;
protected int offset;
protected int length;
//added by ujihara for decryption
protected int objNum = 0;
protected int objGen = 0;
public PRStream(PRStream stream, PdfDictionary newDic) {
reader = stream.reader;
... |
remove(PdfName.FILTER);
this.offset = -1;
if (Document.compress && compress) {
try {
ByteArrayOutputStream stream = new ByteArrayOutputStream();
Deflater deflater = new Deflater(compressionLevel);
DeflaterOutputStream zip = new Deflate... | 1,400 | 193 | 1,593 | <methods>public void <init>(byte[]) ,public void <init>(java.io.InputStream, com.lowagie.text.pdf.PdfWriter) ,public void flateCompress() ,public void flateCompress(int) ,public long getRawLength() ,public void toPdf(com.lowagie.text.pdf.PdfWriter, java.io.OutputStream) throws java.io.IOException,public java.lang.Strin... |
LibrePDF_OpenPDF | OpenPDF/openpdf/src/main/java/com/lowagie/text/pdf/PageResources.java | PageResources | setOriginalResources | class PageResources {
protected PdfDictionary fontDictionary = new PdfDictionary();
protected PdfDictionary xObjectDictionary = new PdfDictionary();
protected PdfDictionary colorDictionary = new PdfDictionary();
protected PdfDictionary patternDictionary = new PdfDictionary();
protected PdfDictionar... |
if (newNamePtr != null) {
namePtr = newNamePtr;
}
forbiddenNames = new HashMap<>();
usedNames = new HashMap<>();
if (resources == null) {
return;
}
originalResources = new PdfDictionary();
originalResources.merge(resources);
... | 1,102 | 221 | 1,323 | <no_super_class> |
LibrePDF_OpenPDF | OpenPDF/openpdf/src/main/java/com/lowagie/text/pdf/PdfAnnotation.java | PdfImportedLink | getDestinationPage | class PdfImportedLink {
float llx, lly, urx, ury;
HashMap<PdfName, PdfObject> parameters = new HashMap<>();
PdfArray destination;
int newPage = 0;
PdfImportedLink(PdfDictionary annotation) {
parameters.putAll(annotation.hashMap);
try {
de... |
if (!isInternal()) {
return 0;
}
// here destination is something like
// [132 0 R, /XYZ, 29.3898, 731.864502, null]
PdfIndirectReference ref = destination.getAsIndirectObject(0);
PRIndirectReference pr = (PRIndirectReference) re... | 1,030 | 217 | 1,247 | <methods>public void <init>() ,public void <init>(com.lowagie.text.pdf.PdfName) ,public void clear() ,public boolean contains(com.lowagie.text.pdf.PdfName) ,public com.lowagie.text.pdf.PdfObject get(com.lowagie.text.pdf.PdfName) ,public com.lowagie.text.pdf.PdfArray getAsArray(com.lowagie.text.pdf.PdfName) ,public com.... |
LibrePDF_OpenPDF | OpenPDF/openpdf/src/main/java/com/lowagie/text/pdf/PdfAppearance.java | PdfAppearance | setFontAndSize | class PdfAppearance extends PdfTemplate {
public static final Map<String, PdfName> stdFieldFontNames = new HashMap<>();
static {
stdFieldFontNames.put("Courier-BoldOblique", new PdfName("CoBO"));
stdFieldFontNames.put("Courier-Bold", new PdfName("CoBo"));
stdFieldFontNames.put("Courier... |
checkWriter();
state.size = size;
if (bf.getFontType() == BaseFont.FONT_TYPE_DOCUMENT) {
state.fontDetails = new FontDetails(null, ((DocumentFont) bf).getIndirectReference(), bf);
} else {
state.fontDetails = writer.addSimple(bf);
}
PdfName psn = ... | 1,432 | 291 | 1,723 | <methods>public void beginVariableText() ,public static com.lowagie.text.pdf.PdfTemplate createTemplate(com.lowagie.text.pdf.PdfWriter, float, float) ,public void endVariableText() ,public com.lowagie.text.Rectangle getBoundingBox() ,public com.lowagie.text.pdf.PdfContentByte getDuplicate() ,public com.lowagie.text.pdf... |
LibrePDF_OpenPDF | OpenPDF/openpdf/src/main/java/com/lowagie/text/pdf/PdfContentParser.java | PdfContentParser | readDictionary | class PdfContentParser {
/**
* Commands have this type.
*/
public static final int COMMAND_TYPE = 200;
/**
* Holds value of property tokeniser.
*/
private PRTokeniser tokeniser;
/**
* Creates a new instance of PdfContentParser
*
* @param tokeniser the tokeniser w... |
PdfDictionary dic = new PdfDictionary();
while (true) {
if (!nextValidToken()) {
throw new IOException(MessageLocalization.getComposedMessage("unexpected.end.of.file"));
}
if (tokeniser.getTokenType() == PRTokeniser.TK_END_DIC) {
break... | 1,194 | 292 | 1,486 | <no_super_class> |
LibrePDF_OpenPDF | OpenPDF/openpdf/src/main/java/com/lowagie/text/pdf/PdfCopyFormsImp.java | PdfCopyFormsImp | copyDocumentFields | class PdfCopyFormsImp extends PdfCopyFieldsImp {
/**
* This sets up the output document
*
* @param os The Outputstream pointing to the output document
* @throws DocumentException
*/
PdfCopyFormsImp(OutputStream os) throws DocumentException {
super(os);
}
/**
* Thi... |
if (!reader.isOpenedWithFullPermissions()) {
throw new IllegalArgumentException(
MessageLocalization.getComposedMessage("pdfreader.not.opened.with.owner.password"));
}
if (readers2intrefs.containsKey(reader)) {
reader = new PdfReader(reader);
... | 218 | 201 | 419 | <methods>public void close() ,public com.lowagie.text.pdf.PdfIndirectReference getPageReference(int) ,public void openDoc() <variables>private final List<java.lang.Object> calculationOrder,private List<java.lang.Object> calculationOrderRefs,boolean closing,protected static final Map<com.lowagie.text.pdf.PdfName,java.la... |
LibrePDF_OpenPDF | OpenPDF/openpdf/src/main/java/com/lowagie/text/pdf/PdfDashPattern.java | PdfDashPattern | toPdf | class PdfDashPattern extends PdfArray {
// membervariables
/**
* This is the length of a dash.
*/
private float dash = -1;
/**
* This is the length of a gap.
*/
private float gap = -1;
/**
* This is the phase.
*/
private float phase = -1;
// constructor... |
os.write('[');
if (dash >= 0) {
new PdfNumber(dash).toPdf(writer, os);
if (gap >= 0) {
os.write(' ');
new PdfNumber(gap).toPdf(writer, os);
}
}
os.write(']');
if (phase >= 0) {
os.write(' ');
... | 584 | 123 | 707 | <methods>public void <init>() ,public void <init>(com.lowagie.text.pdf.PdfObject) ,public void <init>(float[]) ,public void <init>(int[]) ,public void <init>(List<? extends com.lowagie.text.pdf.PdfObject>) ,public void <init>(com.lowagie.text.pdf.PdfArray) ,public boolean add(com.lowagie.text.pdf.PdfObject) ,public boo... |
LibrePDF_OpenPDF | OpenPDF/openpdf/src/main/java/com/lowagie/text/pdf/PdfDestination.java | PdfDestination | addPage | class PdfDestination extends PdfArray {
// public static final member-variables
/**
* This is a possible destination type
*/
public static final int XYZ = 0;
/**
* This is a possible destination type
*/
public static final int FIT = 1;
/**
* This is a possible destin... |
if (!status) {
addFirst(page);
status = true;
return true;
}
return false;
| 1,721 | 36 | 1,757 | <methods>public void <init>() ,public void <init>(com.lowagie.text.pdf.PdfObject) ,public void <init>(float[]) ,public void <init>(int[]) ,public void <init>(List<? extends com.lowagie.text.pdf.PdfObject>) ,public void <init>(com.lowagie.text.pdf.PdfArray) ,public boolean add(com.lowagie.text.pdf.PdfObject) ,public boo... |
LibrePDF_OpenPDF | OpenPDF/openpdf/src/main/java/com/lowagie/text/pdf/PdfDeveloperExtension.java | PdfDeveloperExtension | getDeveloperExtensions | class PdfDeveloperExtension {
/**
* An instance of this class for Adobe 1.7 Extension level 3.
*/
public static final PdfDeveloperExtension ADOBE_1_7_EXTENSIONLEVEL3 =
new PdfDeveloperExtension(PdfName.ADBE, PdfWriter.PDF_VERSION_1_7, 3);
/**
* The prefix used in the Extensions ... |
PdfDictionary developerextensions = new PdfDictionary();
developerextensions.put(PdfName.BASEVERSION, baseversion);
developerextensions.put(PdfName.EXTENSIONLEVEL, new PdfNumber(extensionLevel));
return developerextensions;
| 490 | 76 | 566 | <no_super_class> |
LibrePDF_OpenPDF | OpenPDF/openpdf/src/main/java/com/lowagie/text/pdf/PdfEFStream.java | PdfEFStream | toPdf | class PdfEFStream extends PdfStream {
/**
* Creates a Stream object using an InputStream and a PdfWriter object
*
* @param in the InputStream that will be read to get the Stream object
* @param writer the writer to which the stream will be added
*/
public PdfEFStream(InputStream in... |
if (inputStream != null && compressed) {
put(PdfName.FILTER, PdfName.FLATEDECODE);
}
PdfEncryption crypto = null;
if (writer != null) {
crypto = writer.getEncryption();
}
if (crypto != null) {
PdfObject filter = get(PdfName.FILTER);
... | 243 | 958 | 1,201 | <methods>public void <init>(byte[]) ,public void <init>(java.io.InputStream, com.lowagie.text.pdf.PdfWriter) ,public void flateCompress() ,public void flateCompress(int) ,public long getRawLength() ,public void toPdf(com.lowagie.text.pdf.PdfWriter, java.io.OutputStream) throws java.io.IOException,public java.lang.Strin... |
LibrePDF_OpenPDF | OpenPDF/openpdf/src/main/java/com/lowagie/text/pdf/PdfFont.java | PdfFont | compareTo | class PdfFont implements Comparable {
/**
* an image.
*/
protected Image image;
protected float hScale = 1;
/**
* the font metrics.
*/
private BaseFont font;
/**
* the size.
*/
private float size;
// constructors
PdfFont(BaseFont bf, float size) {
... |
if (image != null) {
return 0;
}
if (object == null) {
return -1;
}
PdfFont pdfFont;
try {
pdfFont = (PdfFont) object;
if (font != pdfFont.font) {
return 1;
}
if (this.size() != pdfFo... | 634 | 138 | 772 | <no_super_class> |
LibrePDF_OpenPDF | OpenPDF/openpdf/src/main/java/com/lowagie/text/pdf/PdfFunction.java | PdfFunction | type2 | class PdfFunction {
protected PdfWriter writer;
protected PdfIndirectReference reference;
protected PdfDictionary dictionary;
/**
* Creates new PdfFunction
*
* @param writer the PdfWriter to associate to the PdfFunction
*/
protected PdfFunction(PdfWriter writer) {
thi... |
PdfFunction func = new PdfFunction(writer);
func.dictionary = new PdfDictionary();
func.dictionary.put(PdfName.FUNCTIONTYPE, new PdfNumber(2));
func.dictionary.put(PdfName.DOMAIN, new PdfArray(domain));
if (range != null) {
func.dictionary.put(PdfName.RANGE, new PdfA... | 1,040 | 215 | 1,255 | <no_super_class> |
LibrePDF_OpenPDF | OpenPDF/openpdf/src/main/java/com/lowagie/text/pdf/PdfGlyphArray.java | PdfGlyphArray | add | class PdfGlyphArray {
private final LinkedList<Object> list = new LinkedList<>();
public void add(float displacement) {
list.add(displacement);
}
public void add(int glyphCode) {<FILL_FUNCTION_BODY>}
List<Object> getList() {
return Collections.unmodifiableList(list);
}
p... |
Object last = list.peekLast();
GlyphSubList glyphSublist;
if (last instanceof GlyphSubList) {
glyphSublist = (GlyphSubList) last;
} else {
glyphSublist = new GlyphSubList();
list.add(glyphSublist);
}
glyphSublist.add(glyphCode);
| 159 | 97 | 256 | <no_super_class> |
LibrePDF_OpenPDF | OpenPDF/openpdf/src/main/java/com/lowagie/text/pdf/PdfLister.java | PdfLister | listStream | class PdfLister {
/**
* the printStream you want to write the output to.
*/
PrintStream out;
/**
* Create a new lister object.
*
* @param out the PrintStream to write the output to
*/
public PdfLister(PrintStream out) {
this.out = out;
}
/**
* Visual... |
try {
listDict(stream);
out.println("startstream");
byte[] b = PdfReader.getStreamBytes(stream);
// byte buf[] = new byte[Math.min(stream.getLength(), 4096)];
// int r = 0;
// stream.openStream(reader);
// f... | 842 | 304 | 1,146 | <no_super_class> |
LibrePDF_OpenPDF | OpenPDF/openpdf/src/main/java/com/lowagie/text/pdf/PdfLiteral.java | PdfLiteral | getPosLength | class PdfLiteral extends PdfObject {
/**
* Holds value of property position.
*/
private long position;
public PdfLiteral(String text) {
super(0, text);
}
public PdfLiteral(byte[] b) {
super(0, b);
}
public PdfLiteral(int size) {
super(0, (byte[]) null);
... |
if (bytes != null) {
return bytes.length;
} else {
return 0;
}
| 361 | 34 | 395 | <methods>public boolean canBeInObjStm() ,public byte[] getBytes() ,public com.lowagie.text.pdf.PRIndirectReference getIndRef() ,public boolean isArray() ,public boolean isBoolean() ,public boolean isDictionary() ,public boolean isIndirect() ,public boolean isName() ,public boolean isNull() ,public boolean isNumber() ,p... |
LibrePDF_OpenPDF | OpenPDF/openpdf/src/main/java/com/lowagie/text/pdf/PdfNameTree.java | PdfNameTree | writeTree | class PdfNameTree {
private static final int leafSize = 64;
/**
* Writes a name tree to a PdfWriter.
*
* @param items the item of the name tree. The key is a <CODE>String</CODE> and the value is a
* <CODE>PdfObject</CODE>. Note that although the keys are strings only the lo... |
if (items.isEmpty()) {
return null;
}
String[] names = items.keySet().toArray(new String[0]);
Arrays.sort(names);
if (names.length <= leafSize) {
PdfDictionary dic = new PdfDictionary();
PdfArray ar = new PdfArray();
for (String na... | 792 | 755 | 1,547 | <no_super_class> |
LibrePDF_OpenPDF | OpenPDF/openpdf/src/main/java/com/lowagie/text/pdf/PdfNumber.java | PdfNumber | compareTo | class PdfNumber extends PdfObject implements Comparable<PdfNumber> {
// CLASS VARIABLES
/**
* actual value of this <CODE>PdfNumber</CODE>, represented as a
* <CODE>double</CODE>
*/
private double value;
// CONSTRUCTORS
/**
* Constructs a <CODE>PdfNumber</CODE>-object.
*
... |
Objects.requireNonNull(o, "PdfNumber is null, can't be compared to current instance.");
if (this == o) {
return 0;
}
return Double.compare(o.value, value);
| 1,012 | 61 | 1,073 | <methods>public boolean canBeInObjStm() ,public byte[] getBytes() ,public com.lowagie.text.pdf.PRIndirectReference getIndRef() ,public boolean isArray() ,public boolean isBoolean() ,public boolean isDictionary() ,public boolean isIndirect() ,public boolean isName() ,public boolean isNull() ,public boolean isNumber() ,p... |
LibrePDF_OpenPDF | OpenPDF/openpdf/src/main/java/com/lowagie/text/pdf/PdfNumberTree.java | PdfNumberTree | writeTree | class PdfNumberTree {
private static final int leafSize = 64;
/**
* Creates a number tree.
*
* @param items the item of the number tree. The key is an <CODE>Integer</CODE> and the value is a
* <CODE>PdfObject</CODE>.
* @param writer the writer
* @return the diction... |
if (items.isEmpty()) {
return null;
}
Integer[] numbers = new Integer[items.size()];
numbers = items.keySet().toArray(numbers);
Arrays.sort(numbers);
if (numbers.length <= leafSize) {
PdfDictionary dic = new PdfDictionary();
PdfArray a... | 488 | 770 | 1,258 | <no_super_class> |
LibrePDF_OpenPDF | OpenPDF/openpdf/src/main/java/com/lowagie/text/pdf/PdfPSXObject.java | PdfPSXObject | getFormXObject | class PdfPSXObject extends PdfTemplate {
/**
* Creates a new instance of PdfPSXObject
*/
protected PdfPSXObject() {
super();
}
/**
* Constructs a PSXObject
*
* @param wr the PdfWriter
*/
public PdfPSXObject(PdfWriter wr) {
super(wr);
}
/**
... |
PdfStream s = new PdfStream(content.toByteArray());
s.put(PdfName.TYPE, PdfName.XOBJECT);
s.put(PdfName.SUBTYPE, PdfName.PS);
s.flateCompress(compressionLevel);
return s;
| 354 | 78 | 432 | <methods>public void beginVariableText() ,public static com.lowagie.text.pdf.PdfTemplate createTemplate(com.lowagie.text.pdf.PdfWriter, float, float) ,public void endVariableText() ,public com.lowagie.text.Rectangle getBoundingBox() ,public com.lowagie.text.pdf.PdfContentByte getDuplicate() ,public com.lowagie.text.pdf... |
LibrePDF_OpenPDF | OpenPDF/openpdf/src/main/java/com/lowagie/text/pdf/PdfPages.java | PdfPages | reorderPages | class PdfPages {
private final ArrayList<PdfIndirectReference> pages = new ArrayList<>();
private final ArrayList<PdfIndirectReference> parents = new ArrayList<>();
private final PdfWriter writer;
private int leafSize = 10;
private PdfIndirectReference topParent;
// constructors
/**
... |
if (order == null) {
return pages.size();
}
if (parents.size() > 1) {
throw new DocumentException(MessageLocalization.getComposedMessage(
"page.reordering.requires.a.single.parent.in.the.page.tree.call.pdfwriter.setlinearmode.after.open"));
}
... | 1,081 | 424 | 1,505 | <no_super_class> |
LibrePDF_OpenPDF | OpenPDF/openpdf/src/main/java/com/lowagie/text/pdf/PdfPublicKeySecurityHandler.java | PdfPublicKeySecurityHandler | computeRecipientInfo | class PdfPublicKeySecurityHandler {
static final int SEED_LENGTH = 20;
private final List<PdfPublicKeyRecipient> recipients;
private byte[] seed = new byte[SEED_LENGTH];
public PdfPublicKeySecurityHandler() {
KeyGenerator key;
try {
key = KeyGenerator.getInstance("AES");
... |
ASN1InputStream asn1inputstream = new ASN1InputStream(
new ByteArrayInputStream(x509certificate.getTBSCertificate()));
TBSCertificate tbsCertificate = TBSCertificate.getInstance(asn1inputstream.readObject());
AlgorithmIdentifier algorithmidentifier = tbsCertificate.getSubjectPub... | 1,495 | 244 | 1,739 | <no_super_class> |
LibrePDF_OpenPDF | OpenPDF/openpdf/src/main/java/com/lowagie/text/pdf/PdfReaderInstance.java | PdfReaderInstance | getNewObjectNumber | class PdfReaderInstance {
static final PdfLiteral IDENTITYMATRIX = new PdfLiteral("[1 0 0 1 0 0]");
static final PdfNumber ONE = new PdfNumber(1);
int[] myXref;
PdfReader reader;
RandomAccessFileOrArray file;
HashMap<Integer, PdfImportedPage> importedPages = new HashMap<>();
PdfWriter write... |
if (myXref[number] == 0) {
myXref[number] = writer.getIndirectReferenceNumber();
nextRound.add(number);
}
return myXref[number];
| 1,326 | 56 | 1,382 | <no_super_class> |
LibrePDF_OpenPDF | OpenPDF/openpdf/src/main/java/com/lowagie/text/pdf/PdfResources.java | PdfResources | add | class PdfResources extends PdfDictionary {
// constructor
/**
* Constructs a PDF ResourcesDictionary.
*/
public PdfResources() {
super();
}
// methods
void add(PdfName key, PdfDictionary resource) {<FILL_FUNCTION_BODY>}
} |
if (resource.size() == 0) {
return;
}
PdfDictionary dic = getAsDict(key);
if (dic == null) {
put(key, resource);
} else {
dic.putAll(resource);
}
| 84 | 70 | 154 | <methods>public void <init>() ,public void <init>(com.lowagie.text.pdf.PdfName) ,public void clear() ,public boolean contains(com.lowagie.text.pdf.PdfName) ,public com.lowagie.text.pdf.PdfObject get(com.lowagie.text.pdf.PdfName) ,public com.lowagie.text.pdf.PdfArray getAsArray(com.lowagie.text.pdf.PdfName) ,public com.... |
LibrePDF_OpenPDF | OpenPDF/openpdf/src/main/java/com/lowagie/text/pdf/PdfShadingPattern.java | PdfShadingPattern | getPatternReference | class PdfShadingPattern extends PdfDictionary {
protected PdfShading shading;
protected PdfWriter writer;
protected float[] matrix = {1, 0, 0, 1, 0, 0};
protected PdfName patternName;
protected PdfIndirectReference patternReference;
/**
* Creates new PdfShadingPattern
*
* @p... |
if (patternReference == null) {
patternReference = writer.getPdfIndirectReference();
}
return patternReference;
| 497 | 36 | 533 | <methods>public void <init>() ,public void <init>(com.lowagie.text.pdf.PdfName) ,public void clear() ,public boolean contains(com.lowagie.text.pdf.PdfName) ,public com.lowagie.text.pdf.PdfObject get(com.lowagie.text.pdf.PdfName) ,public com.lowagie.text.pdf.PdfArray getAsArray(com.lowagie.text.pdf.PdfName) ,public com.... |
LibrePDF_OpenPDF | OpenPDF/openpdf/src/main/java/com/lowagie/text/pdf/PdfSigGenericPKCS.java | PdfSigGenericPKCS | setSignInfo | class PdfSigGenericPKCS extends PdfSignature {
/**
* The hash algorithm, for example "SHA1"
*/
protected String hashAlgorithm;
/**
* The crypto provider
*/
protected String provider = null;
/**
* The class instance that calculates the PKCS#1 and PKCS#7
*/
protected... |
try {
pkcs = new PdfPKCS7(privKey, certChain, crlList, hashAlgorithm, provider,
PdfName.ADBE_PKCS7_SHA1.equals(get(PdfName.SUBFILTER)));
pkcs.setExternalDigest(externalDigest, externalRSAdata, digestEncryptionAlgorithm);
if (PdfName.ADBE_X509_RSA_SHA1.equ... | 1,375 | 400 | 1,775 | <methods>public void <init>(com.lowagie.text.pdf.PdfName, com.lowagie.text.pdf.PdfName) ,public com.lowagie.text.pdf.PdfSignatureBuildProperties getPdfSignatureBuildProperties() ,public void setByteRange(int[]) ,public void setCert(byte[]) ,public void setContact(java.lang.String) ,public void setContents(byte[]) ,publ... |
LibrePDF_OpenPDF | OpenPDF/openpdf/src/main/java/com/lowagie/text/pdf/PdfSignature.java | PdfSignature | setByteRange | class PdfSignature extends PdfDictionary {
/**
* Creates new PdfSignature
*
* @param filter the filter
* @param subFilter the sub filter
*/
public PdfSignature(PdfName filter, PdfName subFilter) {
super(PdfName.SIG);
put(PdfName.FILTER, filter);
put(PdfName.S... |
PdfArray array = new PdfArray();
for (int i : range) {
array.add(new PdfNumber(i));
}
put(PdfName.BYTERANGE, array);
| 565 | 55 | 620 | <methods>public void <init>() ,public void <init>(com.lowagie.text.pdf.PdfName) ,public void clear() ,public boolean contains(com.lowagie.text.pdf.PdfName) ,public com.lowagie.text.pdf.PdfObject get(com.lowagie.text.pdf.PdfName) ,public com.lowagie.text.pdf.PdfArray getAsArray(com.lowagie.text.pdf.PdfName) ,public com.... |
LibrePDF_OpenPDF | OpenPDF/openpdf/src/main/java/com/lowagie/text/pdf/PdfSignatureBuildProperties.java | PdfSignatureBuildProperties | getPdfSignatureAppProperty | class PdfSignatureBuildProperties extends PdfDictionary {
public PdfSignatureBuildProperties() {
super();
}
/**
* Returns the {@link PdfSignatureAppDataDict} from this dictionary. If it doesn't exist, a new
* {@link PdfSignatureAppDataDict} is added.
*
* @return {@link PdfSigna... |
PdfSignatureAppDataDict appPropDic = (PdfSignatureAppDataDict) getAsDict(PdfName.APP);
if (appPropDic == null) {
appPropDic = new PdfSignatureAppDataDict();
put(PdfName.APP, appPropDic);
}
return appPropDic;
| 131 | 91 | 222 | <methods>public void <init>() ,public void <init>(com.lowagie.text.pdf.PdfName) ,public void clear() ,public boolean contains(com.lowagie.text.pdf.PdfName) ,public com.lowagie.text.pdf.PdfObject get(com.lowagie.text.pdf.PdfName) ,public com.lowagie.text.pdf.PdfArray getAsArray(com.lowagie.text.pdf.PdfName) ,public com.... |
LibrePDF_OpenPDF | OpenPDF/openpdf/src/main/java/com/lowagie/text/pdf/PdfSmartCopy.java | PdfSmartCopy | copyIndirect | class PdfSmartCopy extends PdfCopy {
/**
* the cache with the streams and references.
*/
private Map<ByteStore, PdfIndirectReference> streamMap = null;
/**
* Creates a PdfSmartCopy instance.
*
* @param os the OutputStream
* @param document the document
* @throws Do... |
PdfObject srcObj = PdfReader.getPdfObjectRelease(in);
ByteStore streamKey = null;
boolean validStream = false;
if (srcObj == null) {
return null;
}
if (srcObj.isStream()) {
try {
streamKey = new ByteStore((PRStream) srcObj);
... | 1,169 | 421 | 1,590 | <methods>public void <init>(com.lowagie.text.Document, java.io.OutputStream) throws com.lowagie.text.DocumentException,public com.lowagie.text.pdf.PdfIndirectReference add(com.lowagie.text.pdf.PdfOutline) ,public void addAnnotation(com.lowagie.text.pdf.PdfAnnotation) ,public void addPage(com.lowagie.text.pdf.PdfImporte... |
LibrePDF_OpenPDF | OpenPDF/openpdf/src/main/java/com/lowagie/text/pdf/PdfSpotColor.java | PdfSpotColor | getSpotObject | class PdfSpotColor {
/**
* The color name
*/
public PdfName name;
/**
* The alternative color space
*/
public Color altcs;
// constructors
/**
* Constructs a new <CODE>PdfSpotColor</CODE>.
*
* @param name a String value
* @param altcs an alternative co... |
PdfArray array = new PdfArray(PdfName.SEPARATION);
array.add(name);
PdfFunction func = null;
if (altcs instanceof ExtendedColor) {
int type = ((ExtendedColor) altcs).type;
switch (type) {
case ExtendedColor.TYPE_GRAY:
array.add... | 228 | 465 | 693 | <no_super_class> |
LibrePDF_OpenPDF | OpenPDF/openpdf/src/main/java/com/lowagie/text/pdf/PdfString.java | PdfString | getOriginalChars | class PdfString extends PdfObject {
// CLASS VARIABLES
/**
* The value of this object.
*/
protected String value = NOTHING;
protected String originalValue = null;
/**
* The encoding.
*/
protected String encoding = TEXT_PDFDOCENCODING;
protected int objNum = 0;
p... |
char[] chars;
if (encoding == null || encoding.length() == 0) {
byte[] bytes = getOriginalBytes();
chars = new char[bytes.length];
for (int i = 0; i < bytes.length; i++) {
chars[i] = (char) (bytes[i] & 0xff);
}
} else if (encoding.... | 1,653 | 366 | 2,019 | <methods>public boolean canBeInObjStm() ,public byte[] getBytes() ,public com.lowagie.text.pdf.PRIndirectReference getIndRef() ,public boolean isArray() ,public boolean isBoolean() ,public boolean isDictionary() ,public boolean isIndirect() ,public boolean isName() ,public boolean isNull() ,public boolean isNumber() ,p... |
LibrePDF_OpenPDF | OpenPDF/openpdf/src/main/java/com/lowagie/text/pdf/PdfStructureElement.java | PdfStructureElement | init | class PdfStructureElement extends PdfDictionary {
/**
* Holds value of property kids.
*/
private PdfStructureElement parent;
private PdfStructureTreeRoot top;
/**
* Holds value of property reference.
*/
private PdfIndirectReference reference;
/**
* Creates a new insta... |
PdfObject kido = parent.get(PdfName.K);
PdfArray kids = null;
if (kido != null && !kido.isArray()) {
throw new IllegalArgumentException(
MessageLocalization.getComposedMessage("the.parent.has.already.another.function"));
}
if (kido == null) {
... | 593 | 171 | 764 | <methods>public void <init>() ,public void <init>(com.lowagie.text.pdf.PdfName) ,public void clear() ,public boolean contains(com.lowagie.text.pdf.PdfName) ,public com.lowagie.text.pdf.PdfObject get(com.lowagie.text.pdf.PdfName) ,public com.lowagie.text.pdf.PdfArray getAsArray(com.lowagie.text.pdf.PdfName) ,public com.... |
LibrePDF_OpenPDF | OpenPDF/openpdf/src/main/java/com/lowagie/text/pdf/PdfStructureTreeRoot.java | PdfStructureTreeRoot | getOrCreatePageKey | class PdfStructureTreeRoot extends PdfDictionary {
private final Map<Integer, PdfObject> parentTree = new HashMap<>();
private final PdfIndirectReference reference;
/** Next key to be used for adding to the parentTree */
private int parentTreeNextKey = 0;
/** Map which connects [page number] with... |
Integer entryForPageArray = pageKeysMap.get(pageNumber);
if (entryForPageArray == null) {
//putting page array
PdfArray ar = new PdfArray();
entryForPageArray = parentTreeNextKey;
parentTree.put(entryForPageArray, ar);
parentTreeNextKey++;
... | 1,260 | 112 | 1,372 | <methods>public void <init>() ,public void <init>(com.lowagie.text.pdf.PdfName) ,public void clear() ,public boolean contains(com.lowagie.text.pdf.PdfName) ,public com.lowagie.text.pdf.PdfObject get(com.lowagie.text.pdf.PdfName) ,public com.lowagie.text.pdf.PdfArray getAsArray(com.lowagie.text.pdf.PdfName) ,public com.... |
LibrePDF_OpenPDF | OpenPDF/openpdf/src/main/java/com/lowagie/text/pdf/PdfTable.java | PdfTable | updateRowAdditionsInternal | class PdfTable extends Rectangle {
// membervariables
/**
* Original table used to build this object
*/
protected Table table;
/**
* Cached column widths.
*/
protected float[] positions;
/**
* this is the number of columns in the table.
*/
private int columns;... |
// correct table : fill empty cells/ parse table in table
Row row;
int prevRows = rows();
int rowNumber = 0;
int groupNumber = 0;
boolean groupChange;
int firstDataRow = table.getLastHeaderRow() + 1;
Cell cell;
PdfCell currentCell;
ArrayLi... | 1,244 | 769 | 2,013 | <methods>public void <init>(float, float, float, float) ,public void <init>(float, float) ,public void <init>(float, float, float, float, int) ,public void <init>(float, float, int) ,public void <init>(com.lowagie.text.Rectangle) ,public void cloneNonPositionParameters(com.lowagie.text.Rectangle) ,public void disableBo... |
LibrePDF_OpenPDF | OpenPDF/openpdf/src/main/java/com/lowagie/text/pdf/PdfTemplate.java | PdfTemplate | createTemplate | class PdfTemplate extends PdfContentByte {
public static final int TYPE_TEMPLATE = 1;
public static final int TYPE_IMPORTED = 2;
public static final int TYPE_PATTERN = 3;
protected int type;
/**
* The indirect reference to this template
*/
protected PdfIndirectReference thisReference;... |
PdfTemplate template = new PdfTemplate(writer);
template.setWidth(width);
template.setHeight(height);
writer.addDirectTemplateSimple(template, forcedName);
return template;
| 1,768 | 54 | 1,822 | <methods>public void <init>(com.lowagie.text.pdf.PdfWriter) ,public void add(com.lowagie.text.pdf.PdfContentByte) ,public void addImage(com.lowagie.text.Image) throws com.lowagie.text.DocumentException,public void addImage(com.lowagie.text.Image, boolean) throws com.lowagie.text.DocumentException,public void addImage(c... |
LibrePDF_OpenPDF | OpenPDF/openpdf/src/main/java/com/lowagie/text/pdf/PdfTextArray.java | PdfTextArray | add | class PdfTextArray {
private List<Object> arrayList = new LinkedList<>();
// To emit a more efficient array, we consolidate
// repeated numbers or strings into single array entries.
// "add( 50 ); add( -50 );" will REMOVE the combined zero from the array.
// the alternative (leaving a zero in ther... |
if (number != 0) {
if (lastNum != null) {
lastNum = number + lastNum;
if (lastNum != 0) {
replaceLast(lastNum);
} else {
arrayList.remove(isRTL ? 0 : arrayList.size() - 1);
}
} else {... | 615 | 163 | 778 | <no_super_class> |
LibrePDF_OpenPDF | OpenPDF/openpdf/src/main/java/com/lowagie/text/pdf/PdfTransition.java | PdfTransition | getTransitionDictionary | class PdfTransition {
/**
* Out Vertical Split
*/
public static final int SPLITVOUT = 1;
/**
* Out Horizontal Split
*/
public static final int SPLITHOUT = 2;
/**
* In Vertical Split
*/
public static final int SPLITVIN = 3;
/**
* IN Horizontal Split
*/... |
PdfDictionary trans = new PdfDictionary(PdfName.TRANS);
switch (type) {
case SPLITVOUT:
trans.put(PdfName.S, PdfName.SPLIT);
trans.put(PdfName.D, new PdfNumber(duration));
trans.put(PdfName.DM, PdfName.V);
trans.put(PdfName.M, ... | 734 | 1,203 | 1,937 | <no_super_class> |
LibrePDF_OpenPDF | OpenPDF/openpdf/src/main/java/com/lowagie/text/pdf/PdfTransparencyGroup.java | PdfTransparencyGroup | setKnockout | class PdfTransparencyGroup extends PdfDictionary {
/**
* Constructs a transparencyGroup.
*/
public PdfTransparencyGroup() {
super();
put(PdfName.S, PdfName.TRANSPARENCY);
}
/**
* Determining the initial backdrop against which its stack is composited.
*
* @param... |
if (knockout) {
put(PdfName.K, PdfBoolean.PDFTRUE);
} else {
remove(PdfName.K);
}
| 246 | 47 | 293 | <methods>public void <init>() ,public void <init>(com.lowagie.text.pdf.PdfName) ,public void clear() ,public boolean contains(com.lowagie.text.pdf.PdfName) ,public com.lowagie.text.pdf.PdfObject get(com.lowagie.text.pdf.PdfName) ,public com.lowagie.text.pdf.PdfArray getAsArray(com.lowagie.text.pdf.PdfName) ,public com.... |
LibrePDF_OpenPDF | OpenPDF/openpdf/src/main/java/com/lowagie/text/pdf/SequenceList.java | SequenceList | getAttributes | class SequenceList {
protected static final int COMMA = 1;
protected static final int MINUS = 2;
protected static final int NOT = 3;
protected static final int TEXT = 4;
protected static final int NUMBER = 5;
protected static final int END = 6;
protected static final char EOT = '\uffff';
... |
low = -1;
high = -1;
odd = even = inverse = false;
int state = OTHER;
while (true) {
int type = getType();
if (type == END || type == COMMA) {
if (state == DIGIT) {
high = low;
}
return (... | 1,618 | 403 | 2,021 | <no_super_class> |
LibrePDF_OpenPDF | OpenPDF/openpdf/src/main/java/com/lowagie/text/pdf/StandardDecryption.java | StandardDecryption | finish | class StandardDecryption {
private static final int AES_128 = 4;
private static final int AES_256_V3 = 6;
protected ARCFOUREncryption arcfour;
protected AESCipher cipher;
private byte[] key;
private boolean aes;
private boolean initiated;
private byte[] iv = new byte[16];
private in... |
if (aes && cipher != null) {
return cipher.doFinal();
} else {
return null;
}
| 564 | 39 | 603 | <no_super_class> |
LibrePDF_OpenPDF | OpenPDF/openpdf/src/main/java/com/lowagie/text/pdf/TTFCache.java | TTFCache | loadTTF | class TTFCache {
private static Map<String, TTFFile> ttfFileMap = new ConcurrentHashMap<>();
public static TTFFile getTTFFile(String fileName, TrueTypeFontUnicode ttu) {
if (ttfFileMap.containsKey(fileName)) {
return ttfFileMap.get(fileName);
}
TTFReader app = new TTFReade... |
try {
return app.loadTTF(fileName, null, true, true);
} catch (IOException e) {
TTFFile ttfFile = new TTFFile(true, true);
InputStream stream = BaseFont.getResourceStream(fileName, null);
try {
if (stream == null) {
st... | 270 | 215 | 485 | <no_super_class> |
LibrePDF_OpenPDF | OpenPDF/openpdf/src/main/java/com/lowagie/text/pdf/Type3Glyph.java | Type3Glyph | addImage | class Type3Glyph extends PdfContentByte {
private PageResources pageResources;
private boolean colorized;
private Type3Glyph() {
super(null);
}
Type3Glyph(PdfWriter writer, PageResources pageResources, float wx, float llx, float lly, float urx, float ury,
boolean colorized) {
... |
if (!colorized && (!image.isMask() || !(image.getBpc() == 1 || image.getBpc() > 0xff))) {
throw new DocumentException(
MessageLocalization.getComposedMessage("not.colorized.typed3.fonts.only.accept.mask.images"));
}
super.addImage(image, a, b, c, d, e, f, inlineI... | 358 | 103 | 461 | <methods>public void <init>(com.lowagie.text.pdf.PdfWriter) ,public void add(com.lowagie.text.pdf.PdfContentByte) ,public void addImage(com.lowagie.text.Image) throws com.lowagie.text.DocumentException,public void addImage(com.lowagie.text.Image, boolean) throws com.lowagie.text.DocumentException,public void addImage(c... |
LibrePDF_OpenPDF | OpenPDF/openpdf/src/main/java/com/lowagie/text/pdf/UnembedFontPdfSmartCopy.java | UnembedFontPdfSmartCopy | copyDictionary | class UnembedFontPdfSmartCopy extends PdfSmartCopy {
public UnembedFontPdfSmartCopy(Document document, OutputStream os)
throws DocumentException {
super(document, os);
}
protected PdfDictionary copyDictionary(PdfDictionary in)
throws IOException, BadPdfFormatException {<FIL... |
PdfDictionary out = new PdfDictionary();
PdfObject type = PdfReader.getPdfObjectRelease(in.get(PdfName.TYPE));
for (PdfName key : in.getKeys()) {
PdfObject value = in.get(key);
if ((PdfName.FONTFILE.equals(key)
|| PdfName.FONTFILE2.equals(key)
... | 94 | 178 | 272 | <methods>public void <init>(com.lowagie.text.Document, java.io.OutputStream) throws com.lowagie.text.DocumentException<variables>private Map<com.lowagie.text.pdf.PdfSmartCopy.ByteStore,com.lowagie.text.pdf.PdfIndirectReference> streamMap |
LibrePDF_OpenPDF | OpenPDF/openpdf/src/main/java/com/lowagie/text/pdf/XfdfReader.java | XfdfReader | endElement | class XfdfReader implements SimpleXMLDocHandler, FieldReader {
// stuff used during parsing to handle state
private boolean foundRoot = false;
private Stack<String> fieldNames = new Stack<>();
private Stack<String> fieldValues = new Stack<>();
// storage for the field list and their values
pri... |
if (tag.equals("value")) {
StringBuilder fName = new StringBuilder();
for (int k = 0; k < fieldNames.size(); ++k) {
fName.append(".").append(fieldNames.elementAt(k));
}
if (fName.toString().startsWith(".")) {
fName = new StringBuil... | 1,182 | 249 | 1,431 | <no_super_class> |
LibrePDF_OpenPDF | OpenPDF/openpdf/src/main/java/com/lowagie/text/pdf/codec/wmf/InputMeta.java | InputMeta | readInt | class InputMeta {
InputStream in;
int length;
public InputMeta(InputStream in) {
this.in = in;
}
public int readWord() throws IOException {
length += 2;
int k1 = in.read();
if (k1 < 0) {
return 0;
}
return (k1 + (in.read() << 8)) & 0xfff... |
length += 4;
int k1 = in.read();
if (k1 < 0) {
return 0;
}
int k2 = in.read() << 8;
int k3 = in.read() << 16;
return k1 + k2 + k3 + (in.read() << 24);
| 326 | 86 | 412 | <no_super_class> |
LibrePDF_OpenPDF | OpenPDF/openpdf/src/main/java/com/lowagie/text/pdf/codec/wmf/MetaBrush.java | MetaBrush | init | class MetaBrush extends MetaObject {
public static final int BS_SOLID = 0;
public static final int BS_NULL = 1;
public static final int BS_HATCHED = 2;
public static final int BS_PATTERN = 3;
public static final int BS_DIBPATTERN = 5;
public static final int HS_HORIZONTAL = 0;
public static... |
style = in.readWord();
color = in.readColor();
hatch = in.readWord();
| 312 | 31 | 343 | <methods>public void <init>() ,public void <init>(int) ,public int getType() <variables>public static final int META_BRUSH,public static final int META_FONT,public static final int META_NOT_SUPPORTED,public static final int META_PEN,public int type |
LibrePDF_OpenPDF | OpenPDF/openpdf/src/main/java/com/lowagie/text/pdf/codec/wmf/MetaFont.java | MetaFont | init | class MetaFont extends MetaObject {
static final String[] fontNames = {
"Courier", "Courier-Bold", "Courier-Oblique", "Courier-BoldOblique",
"Helvetica", "Helvetica-Bold", "Helvetica-Oblique", "Helvetica-BoldOblique",
"Times-Roman", "Times-Bold", "Times-Italic", "Times-BoldItali... |
height = Math.abs(in.readShort());
in.skip(2);
angle = (float) (in.readShort() / 1800.0 * Math.PI);
in.skip(2);
bold = (in.readShort() >= BOLDTHRESHOLD ? MARKER_BOLD : 0);
italic = (in.readByte() != 0 ? MARKER_ITALIC : 0);
underline = (in.readByte() != 0);
... | 1,323 | 320 | 1,643 | <methods>public void <init>() ,public void <init>(int) ,public int getType() <variables>public static final int META_BRUSH,public static final int META_FONT,public static final int META_NOT_SUPPORTED,public static final int META_PEN,public int type |
LibrePDF_OpenPDF | OpenPDF/openpdf/src/main/java/com/lowagie/text/pdf/codec/wmf/MetaPen.java | MetaPen | init | class MetaPen extends MetaObject {
public static final int PS_SOLID = 0;
public static final int PS_DASH = 1;
public static final int PS_DOT = 2;
public static final int PS_DASHDOT = 3;
public static final int PS_DASHDOTDOT = 4;
public static final int PS_NULL = 5;
public static final int P... |
style = in.readWord();
penWidth = in.readShort();
in.readWord();
color = in.readColor();
| 245 | 38 | 283 | <methods>public void <init>() ,public void <init>(int) ,public int getType() <variables>public static final int META_BRUSH,public static final int META_FONT,public static final int META_NOT_SUPPORTED,public static final int META_PEN,public int type |
LibrePDF_OpenPDF | OpenPDF/openpdf/src/main/java/com/lowagie/text/pdf/collection/PdfCollectionField.java | PdfCollectionField | isCollectionItem | class PdfCollectionField extends PdfDictionary {
/**
* A possible type of collection field.
*/
public static final int TEXT = 0;
/**
* A possible type of collection field.
*/
public static final int DATE = 1;
/**
* A possible type of collection field.
*/
public sta... |
switch (fieldType) {
case TEXT:
case DATE:
case NUMBER:
return true;
default:
return false;
}
| 1,134 | 47 | 1,181 | <methods>public void <init>() ,public void <init>(com.lowagie.text.pdf.PdfName) ,public void clear() ,public boolean contains(com.lowagie.text.pdf.PdfName) ,public com.lowagie.text.pdf.PdfObject get(com.lowagie.text.pdf.PdfName) ,public com.lowagie.text.pdf.PdfArray getAsArray(com.lowagie.text.pdf.PdfName) ,public com.... |
LibrePDF_OpenPDF | OpenPDF/openpdf/src/main/java/com/lowagie/text/pdf/collection/PdfCollectionItem.java | PdfCollectionItem | addItem | class PdfCollectionItem extends PdfDictionary {
/**
* The PdfCollectionSchema with the names and types of the items.
*/
PdfCollectionSchema schema;
/**
* Constructs a Collection Item that can be added to a PdfFileSpecification.
*
* @param schema the PdfCollectionSchema
*/
... |
PdfName fieldname = new PdfName(key);
PdfCollectionField field = (PdfCollectionField) schema.get(fieldname);
if (field.fieldType == PdfCollectionField.TEXT) {
put(fieldname, value);
}
| 1,066 | 68 | 1,134 | <methods>public void <init>() ,public void <init>(com.lowagie.text.pdf.PdfName) ,public void clear() ,public boolean contains(com.lowagie.text.pdf.PdfName) ,public com.lowagie.text.pdf.PdfObject get(com.lowagie.text.pdf.PdfName) ,public com.lowagie.text.pdf.PdfArray getAsArray(com.lowagie.text.pdf.PdfName) ,public com.... |
LibrePDF_OpenPDF | OpenPDF/openpdf/src/main/java/com/lowagie/text/pdf/collection/PdfCollectionSort.java | PdfCollectionSort | setSortOrder | class PdfCollectionSort extends PdfDictionary {
/**
* Constructs a PDF Collection Sort Dictionary.
*
* @param key the key of the field that will be used to sort entries
*/
public PdfCollectionSort(String key) {
super(PdfName.COLLECTIONSORT);
put(PdfName.S, new PdfName(key));... |
PdfObject o = get(PdfName.S);
if (o instanceof PdfArray) {
if (((PdfArray) o).size() != ascending.length) {
throw new IllegalArgumentException(MessageLocalization.getComposedMessage(
"the.number.of.booleans.in.this.array.doesn.t.correspond.with.the.nu... | 449 | 204 | 653 | <methods>public void <init>() ,public void <init>(com.lowagie.text.pdf.PdfName) ,public void clear() ,public boolean contains(com.lowagie.text.pdf.PdfName) ,public com.lowagie.text.pdf.PdfObject get(com.lowagie.text.pdf.PdfName) ,public com.lowagie.text.pdf.PdfArray getAsArray(com.lowagie.text.pdf.PdfName) ,public com.... |
LibrePDF_OpenPDF | OpenPDF/openpdf/src/main/java/com/lowagie/text/pdf/crypto/AESCipher.java | AESCipher | doFinal | class AESCipher {
private final PaddedBufferedBlockCipher bp;
/**
* Creates a new instance of AESCipher
*
* @param forEncryption If it is for encryption
* @param iv An initialization vector
* @param key Bytes for key
*/
public AESCipher(boolean forEncrypt... |
int neededLen = bp.getOutputSize(0);
byte[] outp = new byte[neededLen];
int n;
try {
n = bp.doFinal(outp, 0);
} catch (Exception ex) {
return outp;
}
if (n != outp.length) {
byte[] outp2 = new byte[n];
System.arrayc... | 337 | 144 | 481 | <no_super_class> |
LibrePDF_OpenPDF | OpenPDF/openpdf/src/main/java/com/lowagie/text/pdf/crypto/ARCFOUREncryption.java | ARCFOUREncryption | encryptARCFOUR | class ARCFOUREncryption {
private byte[] state = new byte[256];
private int x;
private int y;
/**
* Creates a new instance of ARCFOUREncryption
*/
public ARCFOUREncryption() {
}
public void prepareARCFOURKey(byte[] key) {
prepareARCFOURKey(key, 0, key.length);
}
... |
int length = len + off;
byte tmp;
for (int k = off; k < length; ++k) {
x = (x + 1) & 255;
y = (state[x] + y) & 255;
tmp = state[x];
state[x] = state[y];
state[y] = tmp;
dataOut[k - off + offOut] = (byte) (dataIn[k] ^ state[... | 484 | 138 | 622 | <no_super_class> |
LibrePDF_OpenPDF | OpenPDF/openpdf/src/main/java/com/lowagie/text/pdf/crypto/IVGenerator.java | IVGenerator | getIV | class IVGenerator {
private static ARCFOUREncryption arcfour;
static {
arcfour = new ARCFOUREncryption();
long time = System.currentTimeMillis();
long mem = Runtime.getRuntime().freeMemory();
String s = time + "+" + mem;
arcfour.prepareARCFOURKey(s.getBytes());
}
... |
byte[] b = new byte[len];
synchronized (arcfour) {
arcfour.encryptARCFOUR(b);
}
return b;
| 251 | 46 | 297 | <no_super_class> |
LibrePDF_OpenPDF | OpenPDF/openpdf/src/main/java/com/lowagie/text/pdf/draw/DottedLineSeparator.java | DottedLineSeparator | draw | class DottedLineSeparator extends LineSeparator {
/**
* the gap between the dots.
*/
protected float gap = 5;
/**
* @see com.lowagie.text.pdf.draw.DrawInterface#draw(com.lowagie.text.pdf.PdfContentByte, float, float, float,
* float, float)
*/
public void draw(PdfContentByte ca... |
canvas.saveState();
canvas.setLineWidth(lineWidth);
canvas.setLineCap(PdfContentByte.LINE_CAP_ROUND);
canvas.setLineDash(0, gap, gap / 2);
drawLine(canvas, llx, urx, y);
canvas.restoreState();
| 265 | 82 | 347 | <methods>public void <init>(float, float, java.awt.Color, int, float) ,public void <init>() ,public void draw(com.lowagie.text.pdf.PdfContentByte, float, float, float, float, float) ,public void drawLine(com.lowagie.text.pdf.PdfContentByte, float, float, float) ,public int getAlignment() ,public java.awt.Color getLineC... |
LibrePDF_OpenPDF | OpenPDF/openpdf/src/main/java/com/lowagie/text/pdf/draw/LineSeparator.java | LineSeparator | drawLine | class LineSeparator extends VerticalPositionMark {
/**
* The thickness of the line.
*/
protected float lineWidth = 1;
/**
* The width of the line as a percentage of the available page width.
*/
protected float percentage = 100;
/**
* The color of the line.
*/
prote... |
float w;
if (getPercentage() < 0) {
w = -getPercentage();
} else {
w = (rightX - leftX) * getPercentage() / 100.0f;
}
float s;
switch (getAlignment()) {
case Element.ALIGN_LEFT:
s = 0;
break;
... | 1,022 | 237 | 1,259 | <methods>public void <init>() ,public void <init>(com.lowagie.text.pdf.draw.DrawInterface, float) ,public void draw(com.lowagie.text.pdf.PdfContentByte, float, float, float, float, float) ,public ArrayList<com.lowagie.text.Element> getChunks() ,public com.lowagie.text.pdf.draw.DrawInterface getDrawInterface() ,public f... |
LibrePDF_OpenPDF | OpenPDF/openpdf/src/main/java/com/lowagie/text/pdf/draw/VerticalPositionMark.java | VerticalPositionMark | getChunks | class VerticalPositionMark implements DrawInterface, Element {
/**
* Another implementation of the DrawInterface; its draw method will overrule LineSeparator.draw().
*/
protected DrawInterface drawInterface = null;
/**
* The offset for the line.
*/
protected float offset = 0;
... |
ArrayList<Element> list = new ArrayList<>();
list.add(new Chunk(this, true));
return list;
| 858 | 34 | 892 | <no_super_class> |
LibrePDF_OpenPDF | OpenPDF/openpdf/src/main/java/com/lowagie/text/pdf/events/FieldPositioningEvents.java | FieldPositioningEvents | onGenericTag | class FieldPositioningEvents extends PdfPageEventHelper implements PdfPCellEvent {
/**
* Some extra padding that will be taken into account when defining the widget.
*/
public float padding;
/**
* Keeps a map with fields that are to be positioned in inGenericTag.
*/
protected Map<St... |
rect.setBottom(rect.getBottom() - 3);
PdfFormField field = genericChunkFields.get(text);
if (field == null) {
TextField tf = new TextField(writer,
new Rectangle(rect.getLeft(padding), rect.getBottom(padding), rect.getRight(padding),
re... | 1,358 | 238 | 1,596 | <methods>public non-sealed void <init>() ,public void onChapter(com.lowagie.text.pdf.PdfWriter, com.lowagie.text.Document, float, com.lowagie.text.Paragraph) ,public void onChapterEnd(com.lowagie.text.pdf.PdfWriter, com.lowagie.text.Document, float) ,public void onCloseDocument(com.lowagie.text.pdf.PdfWriter, com.lowag... |
LibrePDF_OpenPDF | OpenPDF/openpdf/src/main/java/com/lowagie/text/pdf/events/PdfPCellEventForwarder.java | PdfPCellEventForwarder | cellLayout | class PdfPCellEventForwarder implements PdfPCellEvent {
/**
* ArrayList containing all the PageEvents that have to be executed.
*/
protected List<PdfPCellEvent> events = new ArrayList<>();
/**
* Add a page event to the forwarder.
*
* @param event an event that has to be added to t... |
PdfPCellEvent event;
for (Object event1 : events) {
event = (PdfPCellEvent) event1;
event.cellLayout(cell, position, canvases);
}
| 241 | 55 | 296 | <no_super_class> |
LibrePDF_OpenPDF | OpenPDF/openpdf/src/main/java/com/lowagie/text/pdf/events/PdfPTableEventForwarder.java | PdfPTableEventForwarder | tableLayout | class PdfPTableEventForwarder implements PdfPTableEvent {
/**
* ArrayList containing all the PageEvents that have to be executed.
*/
protected List<PdfPTableEvent> events = new ArrayList<>();
/**
* Add a page event to the forwarder.
*
* @param event an event that has to be added t... |
PdfPTableEvent event;
for (Object event1 : events) {
event = (PdfPTableEvent) event1;
event.tableLayout(table, widths, heights, headerRows, rowStart, canvases);
}
| 256 | 64 | 320 | <no_super_class> |
LibrePDF_OpenPDF | OpenPDF/openpdf/src/main/java/com/lowagie/text/pdf/events/PdfPageEventForwarder.java | PdfPageEventForwarder | onChapterEnd | class PdfPageEventForwarder implements PdfPageEvent {
/**
* ArrayList containing all the PageEvents that have to be executed.
*/
protected List<PdfPageEvent> events = new ArrayList<>();
/**
* Add a page event to the forwarder.
*
* @param event an event that has to be added to the ... |
PdfPageEvent event;
for (Object event1 : events) {
event = (PdfPageEvent) event1;
event.onChapterEnd(writer, document, position);
}
| 1,952 | 52 | 2,004 | <no_super_class> |
LibrePDF_OpenPDF | OpenPDF/openpdf/src/main/java/com/lowagie/text/pdf/fonts/cmaps/CMap.java | CMap | addMapping | class CMap {
private List<CodespaceRange> codeSpaceRanges = new ArrayList<>();
private Map<Integer, String> singleByteMappings = new HashMap<>();
private Map<Integer, String> doubleByteMappings = new HashMap<>();
/**
* Creates a new instance of CMap.
*/
public CMap() {
//default ... |
if (src.length == 1) {
singleByteMappings.put(src[0] & 0xff, dest);
} else if (src.length == 2) {
int intSrc = src[0] & 0xFF;
intSrc <<= 8;
intSrc |= (src[1] & 0xFF);
doubleByteMappings.put(intSrc, dest);
} else {
throw new... | 844 | 159 | 1,003 | <no_super_class> |
LibrePDF_OpenPDF | OpenPDF/openpdf/src/main/java/com/lowagie/text/pdf/hyphenation/ByteVector.java | ByteVector | alloc | class ByteVector implements Serializable {
private static final long serialVersionUID = -1096301185375029343L;
/**
* Capacity increment size
*/
private static final int DEFAULT_BLOCK_SIZE = 2048;
private int blockSize;
/**
* The encapsulated array
*/
private byte[] array;
... |
int index = n;
int len = array.length;
if (n + size >= len) {
byte[] aux = new byte[len + blockSize];
System.arraycopy(array, 0, aux, 0, len);
array = aux;
}
n += size;
return index;
| 587 | 83 | 670 | <no_super_class> |
LibrePDF_OpenPDF | OpenPDF/openpdf/src/main/java/com/lowagie/text/pdf/hyphenation/CharVector.java | CharVector | clone | class CharVector implements Cloneable, Serializable {
private static final long serialVersionUID = -4875768298308363544L;
/**
* Capacity increment size
*/
private static final int DEFAULT_BLOCK_SIZE = 2048;
private int blockSize;
/**
* The encapsulated array
*/
private char... |
CharVector cv = new CharVector(array.clone(), blockSize);
cv.n = this.n;
return cv;
| 686 | 38 | 724 | <no_super_class> |
LibrePDF_OpenPDF | OpenPDF/openpdf/src/main/java/com/lowagie/text/pdf/hyphenation/Hyphen.java | Hyphen | toString | class Hyphen implements Serializable {
private static final long serialVersionUID = -7666138517324763063L;
public String preBreak;
public String noBreak;
public String postBreak;
Hyphen(String pre, String no, String post) {
preBreak = pre;
noBreak = no;
postBreak = post;
... |
if (noBreak == null
&& postBreak == null
&& preBreak != null
&& preBreak.equals("-")) {
return "-";
}
StringBuilder res = new StringBuilder("{");
res.append(preBreak);
res.append("}{");
res.append(postBreak);
... | 163 | 115 | 278 | <no_super_class> |
LibrePDF_OpenPDF | OpenPDF/openpdf/src/main/java/com/lowagie/text/pdf/hyphenation/Hyphenation.java | Hyphenation | toString | class Hyphenation {
private int[] hyphenPoints;
private String word;
/**
* number of hyphenation points in word
*/
private int len;
/**
* rawWord as made of alternating strings and {@link Hyphen Hyphen} instances
*/
Hyphenation(String word, int[] points) {
this.wor... |
StringBuilder str = new StringBuilder();
int start = 0;
for (int i = 0; i < len; i++) {
str.append(word, start, hyphenPoints[i]).append('-');
start = hyphenPoints[i];
}
str.append(word.substring(start));
return str.toString();
| 355 | 91 | 446 | <no_super_class> |
LibrePDF_OpenPDF | OpenPDF/openpdf/src/main/java/com/lowagie/text/pdf/hyphenation/Hyphenator.java | Hyphenator | getHyphenationTree | class Hyphenator {
private static final String defaultHyphLocation = "com/lowagie/text/pdf/hyphenation/hyph/";
/**
* TODO: Don't use statics
*/
private static Map<String, HyphenationTree> hyphenTrees = new Hashtable<>();
/**
* Holds value of property hyphenDir.
*/
private static... |
String key = lang;
// check whether the country code has been used
if (country != null && !country.equals("none")) {
key += "_" + country;
}
// first try to find it in the cache
if (hyphenTrees.containsKey(key)) {
return hyphenTrees.get(key);
... | 1,755 | 213 | 1,968 | <no_super_class> |
LibrePDF_OpenPDF | OpenPDF/openpdf/src/main/java/com/lowagie/text/pdf/hyphenation/SimplePatternParser.java | SimplePatternParser | normalizeException | class SimplePatternParser implements SimpleXMLDocHandler,
PatternConsumer {
static final int ELEM_CLASSES = 1;
static final int ELEM_EXCEPTIONS = 2;
static final int ELEM_PATTERNS = 3;
static final int ELEM_HYPHEN = 4;
int currElement;
PatternConsumer consumer;
StringBuffer token;
... |
List<Object> res = new ArrayList<>();
for (Object item : ex) {
if (item instanceof String) {
String str = (String) item;
StringBuilder buf = new StringBuilder();
for (int j = 0; j < str.length(); j++) {
char c = str.charAt(... | 1,599 | 247 | 1,846 | <no_super_class> |
LibrePDF_OpenPDF | OpenPDF/openpdf/src/main/java/com/lowagie/text/pdf/internal/PdfVersionImp.java | PdfVersionImp | addToCatalog | class PdfVersionImp implements PdfVersion {
/**
* Contains different strings that are part of the header.
*/
public static final byte[][] HEADER = {
DocWriter.getISOBytes("\n"),
DocWriter.getISOBytes("%PDF-"),
DocWriter.getISOBytes("\n%\u00e2\u00e3\u00cf\u00d3\n")
... |
if (catalog_version != null) {
catalog.put(PdfName.VERSION, catalog_version);
}
if (extensions != null) {
catalog.put(PdfName.EXTENSIONS, extensions);
}
| 1,430 | 65 | 1,495 | <no_super_class> |
LibrePDF_OpenPDF | OpenPDF/openpdf/src/main/java/com/lowagie/text/pdf/internal/PolylineShape.java | PolylineShape | rect | class PolylineShape implements Shape {
/**
* All the X-values of the coordinates in the polyline.
*/
protected int[] x;
/**
* All the Y-values of the coordinates in the polyline.
*/
protected int[] y;
/**
* The total number of points.
*/
protected int np;
/**
... |
if (np == 0) {
return null;
}
int xMin = x[0], yMin = y[0], xMax = x[0], yMax = y[0];
for (int i = 1; i < np; i++) {
if (x[i] < xMin) {
xMin = x[i];
} else if (x[i] > xMax) {
xMax = x[i];
}
if (... | 1,290 | 195 | 1,485 | <no_super_class> |
LibrePDF_OpenPDF | OpenPDF/openpdf/src/main/java/com/lowagie/text/pdf/internal/PolylineShapeIterator.java | PolylineShapeIterator | currentSegment | class PolylineShapeIterator implements PathIterator {
/**
* The polyline over which we are going to iterate.
*/
protected PolylineShape poly;
/**
* an affine transformation to be performed on the polyline.
*/
protected AffineTransform affine;
/**
* the index of the current ... |
if (isDone()) {
throw new NoSuchElementException(MessageLocalization.getComposedMessage("line.iterator.out.of.bounds"));
}
int type = (index == 0) ? SEG_MOVETO : SEG_LINETO;
coords[0] = poly.x[index];
coords[1] = poly.y[index];
if (affine != null) {
... | 1,120 | 138 | 1,258 | <no_super_class> |
LibrePDF_OpenPDF | OpenPDF/openpdf/src/main/java/com/lowagie/text/pdf/parser/GraphicsState.java | GraphicsState | calculateCharacterWidthWithSpace | class GraphicsState {
/**
* The current transformation matrix.
*/
private Matrix ctm;
/**
* The current character spacing.
*/
private float characterSpacing;
/**
* The current word spacing.
*/
private float wordSpacing;
/**
* The current horizontal scaling... |
return (charFontWidth * fontSize + characterSpacing + wordSpacing) * horizontalScaling;
| 1,272 | 27 | 1,299 | <no_super_class> |
LibrePDF_OpenPDF | OpenPDF/openpdf/src/main/java/com/lowagie/text/pdf/parser/MarkedUpTextAssembler.java | MarkedUpTextAssembler | concatenateResult | class MarkedUpTextAssembler implements TextAssembler {
/**
* our result may be partially processed already, in which case we'll just add things to it, once ready.
*/
List<FinalText> result = new ArrayList<>();
private PdfReader reader;
private ParsedTextImpl inProgress = null;
private int... |
// null element means that this is a formatting artifact, not content.
if (containingElementName == null) {
// at some point, we may want to extract alternate text for some
// artifacts.
return null;
}
StringBuilder res = new StringBuilder();
... | 1,772 | 265 | 2,037 | <no_super_class> |
LibrePDF_OpenPDF | OpenPDF/openpdf/src/main/java/com/lowagie/text/pdf/parser/PdfContentReaderTool.java | PdfContentReaderTool | main | class PdfContentReaderTool {
/**
* Shows the detail of a dictionary. This is similar to the PdfLister functionality.
*
* @param dic the dictionary of which you want the detail
* @return a String representation of the dictionary
*/
public static String getDictionaryDetail(PdfDictionary ... |
try {
if (args.length < 1 || args.length > 3) {
System.out.println("Usage: PdfContentReaderTool <pdf file> [<output file>|stdout] [<page num>]");
return;
}
PrintWriter writer = new PrintWriter(System.out);
if (args.length >= 2) {... | 1,330 | 322 | 1,652 | <no_super_class> |
LibrePDF_OpenPDF | OpenPDF/openpdf/src/main/java/com/lowagie/text/pdf/parser/PdfContentStreamHandler.java | TextMoveStartNextLineWithLeading | invoke | class TextMoveStartNextLineWithLeading implements ContentOperator {
private final PdfContentStreamHandler.TextMoveStartNextLine moveStartNextLine;
private final PdfContentStreamHandler.SetTextLeading setTextLeading;
public TextMoveStartNextLineWithLeading(
PdfContentStreamHand... |
float ty = ((PdfNumber) operands.get(1)).floatValue();
List<PdfObject> tlOperands = new ArrayList<>(1);
tlOperands.add(0, new PdfNumber(-ty));
setTextLeading.invoke(tlOperands, handler, resources);
moveStartNextLine.invoke(operands, handler, resources);
... | 235 | 94 | 329 | <no_super_class> |
LibrePDF_OpenPDF | OpenPDF/openpdf/src/main/java/com/lowagie/text/pdf/parser/PdfTextExtractor.java | PdfTextExtractor | getContentBytesFromContentObject | class PdfTextExtractor {
/**
* The PdfReader that holds the PDF file.
*/
private final PdfReader reader;
/**
* The {@link TextAssembler} that will receive render notifications and provide resultant text
*/
private final TextAssembler renderListener;
/**
* Creates a new Te... |
final byte[] result;
switch (contentObject.type()) {
case PdfObject.INDIRECT:
PRIndirectReference ref = (PRIndirectReference) contentObject;
PdfObject directObject = PdfReader.getPdfObject(ref);
result = getContentBytesFromContentObject(direct... | 1,208 | 289 | 1,497 | <no_super_class> |
LibrePDF_OpenPDF | OpenPDF/openpdf/src/main/java/com/lowagie/text/pdf/parser/Vector.java | Vector | cross | class Vector {
/**
* index of the X coordinate
*/
private static final int I1 = 0;
/**
* index of the Y coordinate
*/
private static final int I2 = 1;
/**
* index of the Z coordinate
*/
private static final int I3 = 2;
/**
* the values inside the vector
... |
float x = values[I1] * by.get(Matrix.I11) + values[I2] * by.get(Matrix.I21) + values[I3] * by.get(Matrix.I31);
float y = values[I1] * by.get(Matrix.I12) + values[I2] * by.get(Matrix.I22) + values[I3] * by.get(Matrix.I32);
float z = values[I1] * by.get(Matrix.I13) + values[I2] * by.get(Matrix.I2... | 1,266 | 181 | 1,447 | <no_super_class> |
LibrePDF_OpenPDF | OpenPDF/openpdf/src/main/java/com/lowagie/text/pdf/parser/Word.java | Word | getFinalText | class Word extends ParsedTextImpl {
/**
* Is this an indivisible fragment, because it contained a space or was split from a space- containing string.
* Non-splittable words can be merged (into new non-splittable words).
*/
private final boolean shouldNotSplit;
/**
* If this word or frag... |
final String text = getText() == null ? "" : getText();
if (useMarkup) {
return new FinalText(wordMarkup(text, reader, page, assembler));
} else {
final boolean hasSpaceAlready = text.startsWith(" ") || text.endsWith(" ");
String prefixSpace = hasSpaceAlready... | 1,838 | 108 | 1,946 | <methods>public abstract boolean breakBefore() ,public float getAscent() ,public com.lowagie.text.pdf.parser.Vector getBaseline() ,public float getDescent() ,public com.lowagie.text.pdf.parser.Vector getEndPoint() ,public float getSingleSpaceWidth() ,public com.lowagie.text.pdf.parser.Vector getStartPoint() ,public jav... |
LibrePDF_OpenPDF | OpenPDF/openpdf/src/main/java/com/lowagie/text/utils/NumberUtilities.java | NumberUtilities | parseFloat | class NumberUtilities {
private NumberUtilities() {
}
/**
* Try parse float from string and return {@link Optional#empty()} in case of {@link NumberFormatException}
*
* @param value string value
* @return {@link Optional} containing parsed value or empty
*/
public static Optio... |
try {
return Optional.of(Float.parseFloat(value));
} catch (NumberFormatException e) {
return Optional.empty();
}
| 220 | 42 | 262 | <no_super_class> |
LibrePDF_OpenPDF | OpenPDF/openpdf/src/main/java/com/lowagie/text/utils/SystemPropertyUtil.java | SystemPropertyUtil | getBoolean | class SystemPropertyUtil {
/**
* Similar to {@link Boolean#getBoolean(String)} but uses the given default value if property were not set.
*
* @param propertyKey the system property key
* @param defaultValue the default value to use if property is not defined.
* @return true if the propert... |
String propertyValue = System.getProperty(propertyKey);
if (propertyValue == null) {
return defaultValue;
}
return Boolean.parseBoolean(propertyValue);
| 143 | 48 | 191 | <no_super_class> |
LibrePDF_OpenPDF | OpenPDF/openpdf/src/main/java/com/lowagie/text/xml/SAXmyHandler.java | SAXmyHandler | endElement | class SAXmyHandler extends SAXiTextHandler<XmlPeer> {
/**
* Constructs a new SAXiTextHandler that will translate all the events triggered by the parser to actions on the
* <CODE>Document</CODE>-object.
*
* @param document this is the document on which events must be triggered
* @param myTa... |
if (myTags.containsKey(name)) {
XmlPeer peer = myTags.get(name);
handleEndingTags(peer.getTag());
} else {
handleEndingTags(name);
}
| 514 | 61 | 575 | <methods>public void <init>(com.lowagie.text.DocListener) ,public void <init>(com.lowagie.text.DocListener, Map<java.lang.String,com.lowagie.text.xml.XmlPeer>, com.lowagie.text.pdf.BaseFont) ,public void <init>(com.lowagie.text.DocListener, Map<java.lang.String,com.lowagie.text.xml.XmlPeer>) ,public void characters(cha... |
LibrePDF_OpenPDF | OpenPDF/openpdf/src/main/java/com/lowagie/text/xml/TagMap.java | TagMap | init | class TagMap extends HashMap<String, XmlPeer> {
private static final long serialVersionUID = -6809383366554350820L;
/**
* Constructs a TagMap
*
* @param tagfile the path to an XML file with the tagmap
*/
public TagMap(String tagfile) {
try {
init(TagMap.class.getCla... |
try {
SAXParserFactory factory = SAXParserFactory.newInstance();
factory.setFeature("http://xml.org/sax/features/external-general-entities", false);
factory.setFeature("http://xml.org/sax/features/external-parameter-entities", false);
SAXParser parser = factory.n... | 1,145 | 141 | 1,286 | <methods>public void <init>() ,public void <init>(int) ,public void <init>(Map<? extends java.lang.String,? extends com.lowagie.text.xml.XmlPeer>) ,public void <init>(int, float) ,public void clear() ,public java.lang.Object clone() ,public com.lowagie.text.xml.XmlPeer compute(java.lang.String, BiFunction<? super java.... |
LibrePDF_OpenPDF | OpenPDF/openpdf/src/main/java/com/lowagie/text/xml/XMLUtil.java | XMLUtil | escapeXML | class XMLUtil {
/**
* Escapes a string with the appropriated XML codes.
*
* @param s the string to be escaped
* @param onlyASCII codes above 127 will always be escaped with &#nn; if <CODE>true</CODE>
* @return the escaped string
*/
public static String escapeXML(String... |
char[] cc = s.toCharArray();
int len = cc.length;
StringBuilder sb = new StringBuilder();
for (int c : cc) {
switch (c) {
case '<':
sb.append("<");
break;
case '>':
sb.append(">... | 116 | 314 | 430 | <no_super_class> |
LibrePDF_OpenPDF | OpenPDF/openpdf/src/main/java/com/lowagie/text/xml/XmlPeer.java | XmlPeer | getAttributes | class XmlPeer {
/**
* This is the name of the alias.
*/
protected String tagname;
/**
* This is the name of the alias.
*/
protected String customTagname;
/**
* This is the Map that contains the aliases of the attributes.
*/
protected Properties attributeAliases =... |
Properties attributes = new Properties();
attributes.putAll(attributeValues);
if (defaultContent != null) {
attributes.put(ElementTags.ITEXT, defaultContent);
}
if (attrs != null) {
for (int i = 0; i < attrs.getLength(); i++) {
String attr... | 760 | 126 | 886 | <no_super_class> |
LibrePDF_OpenPDF | OpenPDF/openpdf/src/main/java/com/lowagie/text/xml/xmp/LangAlt.java | LangAlt | toString | class LangAlt extends Properties {
/**
* Key for the default language.
*/
public static final String DEFAULT = "x-default";
/**
* A serial version id.
*/
private static final long serialVersionUID = 4396971487200843099L;
/**
* Creates a Properties object that stores langua... |
StringBuffer sb = new StringBuffer();
sb.append("<rdf:Alt>");
for (Enumeration e = this.propertyNames(); e.hasMoreElements(); ) {
process(sb, e.nextElement());
}
sb.append("</rdf:Alt>");
return sb.toString();
| 405 | 83 | 488 | <methods>public void <init>() ,public void <init>(int) ,public void <init>(java.util.Properties) ,public synchronized void clear() ,public synchronized java.lang.Object clone() ,public synchronized java.lang.Object compute(java.lang.Object, BiFunction<? super java.lang.Object,? super java.lang.Object,?>) ,public synchr... |
LibrePDF_OpenPDF | OpenPDF/openpdf/src/main/java/com/lowagie/text/xml/xmp/XmpArray.java | XmpArray | toString | class XmpArray extends ArrayList<String> {
/**
* An array that is unordered.
*/
public static final String UNORDERED = "rdf:Bag";
/**
* An array that is ordered.
*/
public static final String ORDERED = "rdf:Seq";
/**
* An array with alternatives.
*/
public static f... |
StringBuilder buf = new StringBuilder("<");
buf.append(type);
buf.append('>');
for (String s : this) {
buf.append("<rdf:li>");
buf.append(XmpSchema.escape(s));
buf.append("</rdf:li>");
}
buf.append("</");
buf.append(type);
... | 276 | 117 | 393 | <methods>public void <init>() ,public void <init>(int) ,public void <init>(Collection<? extends java.lang.String>) ,public boolean add(java.lang.String) ,public void add(int, java.lang.String) ,public boolean addAll(Collection<? extends java.lang.String>) ,public boolean addAll(int, Collection<? extends java.lang.Strin... |
LibrePDF_OpenPDF | OpenPDF/openpdf/src/main/java/com/lowagie/text/xml/xmp/XmpReader.java | XmpReader | replace | class XmpReader {
private Document domDocument;
/**
* Constructs an XMP reader
*
* @param bytes the XMP content
* @throws ExceptionConverter on error
* @throws IOException on error
* @throws SAXException on error
*/
public XmpReader(byte[] bytes) throws SAXE... |
NodeList nodes = domDocument.getElementsByTagNameNS(namespaceURI, localName);
Node node;
if (nodes.getLength() == 0) {
return false;
}
for (int i = 0; i < nodes.getLength(); i++) {
node = nodes.item(i);
setNodeText(domDocument, node, value);
... | 1,127 | 102 | 1,229 | <no_super_class> |
LibrePDF_OpenPDF | OpenPDF/openpdf/src/main/java/com/lowagie/text/xml/xmp/XmpSchema.java | XmpSchema | escape | class XmpSchema extends Properties {
private static final long serialVersionUID = -176374295948945272L;
/**
* the namesspace
*/
protected String xmlns;
/**
* Constructs an XMP schema.
*
* @param xmlns xml namespace name
*/
public XmpSchema(String xmlns) {
sup... |
StringBuilder buf = new StringBuilder();
for (int i = 0; i < content.length(); i++) {
switch (content.charAt(i)) {
case '<':
buf.append("<");
break;
case '>':
buf.append(">");
... | 754 | 174 | 928 | <methods>public void <init>() ,public void <init>(int) ,public void <init>(java.util.Properties) ,public synchronized void clear() ,public synchronized java.lang.Object clone() ,public synchronized java.lang.Object compute(java.lang.Object, BiFunction<? super java.lang.Object,? super java.lang.Object,?>) ,public synchr... |
LibrePDF_OpenPDF | OpenPDF/pdf-swing/src/main/java/com/lowagie/rups/Rups.java | Rups | startApplication | class Rups {
// main method
/**
* Serial Version UID.
*/
private static final long serialVersionUID = 4386633640535735848L;
// methods
/**
* Main method. Starts the RUPS application.
*
* @param args no arguments needed
*/
public static void main(String[] args) {... |
// creates a JFrame
JFrame frame = new JFrame();
// defines the size and location
Dimension screen = Toolkit.getDefaultToolkit().getScreenSize();
frame.setSize((int) (screen.getWidth() * .90), (int) (screen.getHeight() * .90));
frame.setLocation((int) (screen.getWidth() ... | 167 | 236 | 403 | <no_super_class> |
LibrePDF_OpenPDF | OpenPDF/pdf-swing/src/main/java/com/lowagie/rups/controller/PdfReaderController.java | PdfReaderController | update | class PdfReaderController extends Observable implements Observer {
/**
* Treeview of the PDF file.
*/
protected PdfTree pdfTree;
/**
* Tabbed Pane containing other components.
*/
protected JTabbedPane navigationTabs;
/**
* JTable with all the pages and their labels.
*/... |
if (RupsMenuBar.CLOSE.equals(obj)) {
setChanged();
notifyObservers(null);
nodes = null;
}
if (obj instanceof PdfObjectTreeNode node) {
nodes.expandNode(node);
if (node.isRecursive()) {
pdfTree.selectNode(node.getAncesto... | 1,901 | 115 | 2,016 | <methods>public void <init>() ,public synchronized void addObserver(java.util.Observer) ,public synchronized int countObservers() ,public synchronized void deleteObserver(java.util.Observer) ,public synchronized void deleteObservers() ,public synchronized boolean hasChanged() ,public void notifyObservers() ,public void... |
LibrePDF_OpenPDF | OpenPDF/pdf-swing/src/main/java/com/lowagie/rups/controller/RupsController.java | RupsController | notifyObservers | class RupsController extends Observable
implements TreeSelectionListener, PageSelectionListener {
// member variables
/* file and controller */
/**
* The Pdf file that is currently open in the application.
*/
protected PdfFile pdfFile;
/**
* Object with the GUI components fo... |
if (obj instanceof FileChooserAction) {
File file = ((FileChooserAction) obj).getFile();
try {
pdfFile = new PdfFile(file);
setChanged();
super.notifyObservers(RupsMenuBar.OPEN);
readerController.startObjectLoader(pdfFile);... | 1,091 | 183 | 1,274 | <methods>public void <init>() ,public synchronized void addObserver(java.util.Observer) ,public synchronized int countObservers() ,public synchronized void deleteObserver(java.util.Observer) ,public synchronized void deleteObservers() ,public synchronized boolean hasChanged() ,public void notifyObservers() ,public void... |
LibrePDF_OpenPDF | OpenPDF/pdf-swing/src/main/java/com/lowagie/rups/io/FileChooserAction.java | FileChooserAction | actionPerformed | class FileChooserAction extends AbstractAction {
/**
* A serial version UID.
*/
private static final long serialVersionUID = 2225830878098387118L;
/**
* An object that is expecting the result of the file chooser action.
*/
protected Observable observable;
/**
* A file filte... |
JFileChooser fc = new JFileChooser();
if (filter != null) {
fc.setFileFilter(filter);
}
int okCancel;
if (newFile) {
okCancel = fc.showSaveDialog(null);
} else {
okCancel = fc.showOpenDialog(null);
}
if (okCancel == JFi... | 419 | 139 | 558 | <methods>public void <init>() ,public void <init>(java.lang.String) ,public void <init>(java.lang.String, javax.swing.Icon) ,public synchronized void addPropertyChangeListener(java.beans.PropertyChangeListener) ,public java.lang.Object[] getKeys() ,public synchronized java.beans.PropertyChangeListener[] getPropertyChan... |
LibrePDF_OpenPDF | OpenPDF/pdf-swing/src/main/java/com/lowagie/rups/io/TextAreaOutputStream.java | TextAreaOutputStream | write | class TextAreaOutputStream extends OutputStream {
/**
* The text area to which we want to write.
*/
protected JTextArea text;
/**
* Keeps track of the offset of the text in the text area.
*/
protected int offset;
/**
* Constructs a TextAreaOutputStream.
*
* @para... |
String snippet = new String(b, off, len);
text.insert(snippet, offset);
offset += len - off;
| 414 | 39 | 453 | <methods>public void <init>() ,public void close() throws java.io.IOException,public void flush() throws java.io.IOException,public static java.io.OutputStream nullOutputStream() ,public abstract void write(int) throws java.io.IOException,public void write(byte[]) throws java.io.IOException,public void write(byte[], in... |
LibrePDF_OpenPDF | OpenPDF/pdf-swing/src/main/java/com/lowagie/rups/model/BackgroundTask.java | BackgroundTask | interrupt | class BackgroundTask {
/**
* A wrapper for the tread that executes a time-consuming task.
*/
private ThreadWrapper thread;
/**
* Starts a thread. Executes the time-consuming task in the construct method; finally calls the finish().
*/
public BackgroundTask() {
final Runnabl... |
Thread t = thread.get();
if (t != null) {
t.interrupt();
}
thread.clear();
| 431 | 38 | 469 | <no_super_class> |
LibrePDF_OpenPDF | OpenPDF/pdf-swing/src/main/java/com/lowagie/rups/model/IndirectObjectFactory.java | IndirectObjectFactory | store | class IndirectObjectFactory {
/**
* The reader object.
*/
protected PdfReader reader;
/**
* The current xref number.
*/
protected int current;
/**
* The highest xref number.
*/
protected int n;
/**
* A list of all the indirect objects in a PDF file.
*... |
if (object.isDictionary()) {
PdfDictionary dict = (PdfDictionary) object;
if (PdfName.PAGE.equals(dict.get(PdfName.TYPE))) {
objects.add(dict);
return;
}
}
objects.add(PdfNull.PDFNULL);
| 1,227 | 82 | 1,309 | <no_super_class> |
LibrePDF_OpenPDF | OpenPDF/pdf-swing/src/main/java/com/lowagie/rups/model/ObjectLoader.java | ObjectLoader | doTask | class ObjectLoader extends BackgroundTask {
/**
* This is the object that will forward the updates to the observers.
*/
protected Observable observable;
/**
* iText's PdfReader object.
*/
protected PdfReader reader;
/**
* The factory that can provide PDF objects.
*/
... |
ProgressDialog progress = new ProgressDialog(null, "Reading PDF file");
objects = new IndirectObjectFactory(reader);
int n = objects.getXRefMaximum();
progress.setMessage("Reading the Cross-Reference table");
progress.setTotal(n);
while (objects.storeNextObject()) {
... | 409 | 143 | 552 | <methods>public void <init>() ,public abstract void doTask() ,public void finished() ,public void interrupt() ,public void start() <variables>private com.lowagie.rups.model.BackgroundTask.ThreadWrapper thread |
LibrePDF_OpenPDF | OpenPDF/pdf-swing/src/main/java/com/lowagie/rups/model/PageLoader.java | PageLoader | loadPage | class PageLoader extends BackgroundTask {
/**
* The PDFFile (SUN's PDF Renderer class)
*/
protected PDFFile file;
/**
* The total number of pages.
*/
protected int numberOfPages;
/**
* True for pages with page number equal to index + 1 that are being loaded.
*/
pro... |
pageNumber--;
if (busy[pageNumber]) {
return null;
}
busy[pageNumber] = true;
PDFPage page = file.getPage(pageNumber + 1, true);
if (!done[pageNumber]) {
System.out.println("Loading page " + (pageNumber + 1));
}
done[pageNumber] = ... | 446 | 112 | 558 | <methods>public void <init>() ,public abstract void doTask() ,public void finished() ,public void interrupt() ,public void start() <variables>private com.lowagie.rups.model.BackgroundTask.ThreadWrapper thread |
LibrePDF_OpenPDF | OpenPDF/pdf-swing/src/main/java/com/lowagie/rups/model/PdfFile.java | PdfFile | readFile | class PdfFile {
// member variables
/**
* The directory where the file can be found (if the PDF was passed as a file).
*/
protected File directory = null;
/**
* The original filename.
*/
protected String filename = null;
/**
* The PdfReader object.
*/
protec... |
// reading the file into PdfReader
permissions = new Permissions();
try {
reader = new PdfReader(pdf, null);
permissions.setEncrypted(false);
} catch (BadPasswordException bpe) {
JPasswordField passwordField = new JPasswordField(32);
JOpti... | 543 | 269 | 812 | <no_super_class> |
LibrePDF_OpenPDF | OpenPDF/pdf-swing/src/main/java/com/lowagie/rups/model/ProgressDialog.java | ProgressDialog | setTotal | class ProgressDialog extends JDialog {
/**
* the icon used for this dialog box.
*/
public static final JLabel INFO = new JLabel(UIManager.getIcon("OptionPane.informationIcon"));
/**
* a serial version uid.
*/
private static final long serialVersionUID = -8286949678008659120L;
/*... |
if (n > 0) {
progress.setMaximum(n);
progress.setIndeterminate(false);
progress.setStringPainted(true);
} else {
progress.setIndeterminate(true);
progress.setStringPainted(false);
}
| 659 | 74 | 733 | <methods>public void <init>() ,public void <init>(java.awt.Frame) ,public void <init>(java.awt.Dialog) ,public void <init>(java.awt.Window) ,public void <init>(java.awt.Frame, boolean) ,public void <init>(java.awt.Frame, java.lang.String) ,public void <init>(java.awt.Dialog, boolean) ,public void <init>(java.awt.Dialog... |
LibrePDF_OpenPDF | OpenPDF/pdf-swing/src/main/java/com/lowagie/rups/model/TreeNodeFactory.java | TreeNodeFactory | expandNode | class TreeNodeFactory {
/**
* The factory that can produce all indirect objects.
*/
protected IndirectObjectFactory objects;
/**
* An list containing the nodes of every indirect object.
*/
protected ArrayList<PdfObjectTreeNode> nodes = new ArrayList<>();
/**
* Creates a fa... |
if (node.getChildCount() > 0) {
return;
}
PdfObject object = node.getPdfObject();
PdfObjectTreeNode leaf;
switch (object.type()) {
case PdfObject.INDIRECT:
PdfIndirectReference ref = (PdfIndirectReference) object;
leaf = ge... | 806 | 306 | 1,112 | <no_super_class> |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.