/** * Converts a {@link com.itextpdf.kernel.pdf.PdfArray} to an array of longs * * @param pdfArray PdfArray to be converted * @return long[] containing the PdfArray values * @deprecated Will be removed in 7.2. Use {@link PdfArray#toLongArray()} instead */ @Deprecated public static long[] asLongArray(PdfArray pdfArray) { long[] rslt = new long[pdfArray.size()]; for (int k = 0; k < rslt.length; ++k) { rslt[k] = pdfArray.getAsNumber(k).longValue(); } return rslt; }
@Override protected void checkPdfNumber(PdfNumber number) { if (Math.abs(number.longValue()) > getMaxRealValue() && number.toString().contains(".")) { throw new PdfAConformanceException(PdfAConformanceException.REAL_NUMBER_IS_OUT_OF_RANGE); } }
@Override protected void checkPdfNumber(PdfNumber number) { if (Math.abs(number.longValue()) > getMaxRealValue() && number.toString().contains(".")) { throw new PdfAConformanceException(PdfAConformanceException.REAL_NUMBER_IS_OUT_OF_RANGE); } }
/** * Converts a {@link com.itextpdf.kernel.pdf.PdfArray} to an array of longs * * @param pdfArray PdfArray to be converted * @return long[] containing the PdfArray values * @deprecated Will be removed in 7.2. Use {@link PdfArray#toLongArray()} instead */ @Deprecated public static long[] asLongArray(PdfArray pdfArray) { long[] rslt = new long[pdfArray.size()]; for (int k = 0; k < rslt.length; ++k) { rslt[k] = pdfArray.getAsNumber(k).longValue(); } return rslt; }
/** * Returns this array as an array of longs. Will throw a PdfException when it encounters an issue. * * @return this array as an array of longs * @throws com.itextpdf.kernel.PdfException if one of the values isn't a number */ public long[] toLongArray() { try { long[] rslt = new long[size()]; for (int k = 0; k < rslt.length; ++ k) { rslt[k] = getAsNumber(k).longValue(); } return rslt; } catch (Exception e) { throw new PdfException(PdfException.CannotConvertPdfArrayToLongArray, e, this); } }
private void initKeyAndReadDictionary(PdfDictionary encryptionDictionary, byte[] password, byte[] documentId, boolean encryptMetadata) { byte[] uValue = getIsoBytes(encryptionDictionary.getAsString(PdfName.U)); byte[] oValue = getIsoBytes(encryptionDictionary.getAsString(PdfName.O)); PdfNumber pValue = (PdfNumber) encryptionDictionary.get(PdfName.P); this.permissions = pValue.longValue(); this.documentId = documentId; keyLength = getKeyLength(encryptionDictionary); byte[] paddedPassword = padPassword(password); checkPassword(encryptMetadata, uValue, oValue, paddedPassword); }
PdfNumber pValue = (PdfNumber) encryptionDictionary.get(PdfName.P); this.permissions = pValue.longValue();
obj = xrefStream.get(PdfName.Prev); if (obj != null) prev = ((PdfNumber) obj).longValue(); xref.setCapacity(size); byte[] b = readStreamBytes(xrefStream, true);