updated history. got rid of one more readallbytes

This commit is contained in:
jstaerk
2023-11-26 18:46:33 +01:00
parent 656fec6359
commit 771fbbab2c
2 changed files with 15 additions and 10 deletions

View File

@@ -1,18 +1,19 @@
2.9.0 2.9.0
======= =======
2023-11-27
Missing closing tag in BankDetails when there's no BIC number #339 - Missing closing tag in BankDetails when there's no BIC number #339
ZUGFeRDExporterFromA3 did not set default ZUGFeRD Version - ZUGFeRDExporterFromA3 did not set default ZUGFeRD Version
Have a way to merge to PDF file without knowing if it is A-1 or A-3 #341 - Have a way to merge to PDF file without knowing if it is A-1 or A-3 #341
Be able to validate XR 3.0 #347 - Be able to validate XR 3.0 #347
2.8.0 2.8.0
======= =======
2023-09-14 2023-09-14
Improvement of included notes #331 - Improvement of included notes #331
fixes #259 by Heavenfighter - fixes #259 by Heavenfighter
introduction of --disable-file-logging command line option - introduction of --disable-file-logging command line option
2.7.3 2.7.3
======= =======

View File

@@ -60,8 +60,12 @@ public class ZUGFeRDExporterFromPDFA implements IZUGFeRDExporter {
return theExporter; return theExporter;
} }
private byte[] fileToByteArrayInputStream(String pdfFilename) throws IOException { protected byte[] filenameToByteArray(String pdfFilename) throws IOException {
FileInputStream fileInputStream = new FileInputStream(pdfFilename); FileInputStream fileInputStream = new FileInputStream(pdfFilename);
return inputstreamToByteArray(fileInputStream);
}
protected byte[] inputstreamToByteArray(InputStream fileInputStream) throws IOException {
byte[] bytes = new byte[fileInputStream.available()]; byte[] bytes = new byte[fileInputStream.available()];
DataInputStream dataInputStream = new DataInputStream(fileInputStream); DataInputStream dataInputStream = new DataInputStream(fileInputStream);
dataInputStream.readFully(bytes); dataInputStream.readFully(bytes);
@@ -105,7 +109,7 @@ public class ZUGFeRDExporterFromPDFA implements IZUGFeRDExporter {
* @throws IOException * @throws IOException
*/ */
public IZUGFeRDExporter load(String pdfFilename) throws IOException { public IZUGFeRDExporter load(String pdfFilename) throws IOException {
determineAndSetExporter(getPDFAVersion(fileToByteArrayInputStream(pdfFilename))); determineAndSetExporter(getPDFAVersion(filenameToByteArray(pdfFilename)));
return theExporter.load(pdfFilename); return theExporter.load(pdfFilename);
} }
@@ -133,7 +137,7 @@ public class ZUGFeRDExporterFromPDFA implements IZUGFeRDExporter {
* @throws IOException if anything is wrong with inputstream * @throws IOException if anything is wrong with inputstream
*/ */
public IZUGFeRDExporter load(InputStream pdfSource) throws IOException { public IZUGFeRDExporter load(InputStream pdfSource) throws IOException {
determineAndSetExporter(getPDFAVersion(pdfSource.readAllBytes())); determineAndSetExporter(getPDFAVersion(inputstreamToByteArray(pdfSource)));
return theExporter.load(pdfSource); return theExporter.load(pdfSource);
} }