/** * Create a temp file to write sheet data. * By default, temp files are created in the default temporary-file directory * with a prefix "poi-sxssf-sheet" and suffix ".xml". Subclasses can override * it and specify a different temp directory or filename or suffix, e.g. <code>.gz</code> * * @return temp file to write sheet data */ public File createTempFile() throws IOException { return TempFile.createTempFile("poi-sxssf-sheet", ".xml"); }
/** * @return temp file to write sheet data */ @Override public File createTempFile() throws IOException { return TempFile.createTempFile("poi-sxssf-sheet-xml", ".gz"); }
protected StandardCipherOutputStream(DirectoryNode dir) throws IOException { this(dir, TempFile.createTempFile("encrypted_package", "crypt")); }
public EncryptedTempData() throws IOException { SecureRandom sr = new SecureRandom(); ivBytes = new byte[16]; byte[] keyBytes = new byte[16]; sr.nextBytes(ivBytes); sr.nextBytes(keyBytes); skeySpec = new SecretKeySpec(keyBytes, cipherAlgorithm.jceId); tempFile = TempFile.createTempFile("poi-temp-data", ".tmp"); }
public ChunkedCipherOutputStream(DirectoryNode dir, int chunkSize) throws IOException, GeneralSecurityException { super(null); this.chunkSize = chunkSize; int cs = chunkSize == STREAMING ? 4096 : chunkSize; this.chunk = IOUtils.safelyAllocate(cs, MAX_RECORD_LENGTH); this.plainByteFlags = new BitSet(cs); this.chunkBits = Integer.bitCount(cs-1); this.fileOut = TempFile.createTempFile("encrypted_package", "crypt"); this.fileOut.deleteOnExit(); this.out = new FileOutputStream(fileOut); this.dir = dir; this.cipher = initCipherForBlock(null, 0, false); }
public static AesZipFileZipEntrySource createZipEntrySource(InputStream is) throws IOException { // generate session key SecureRandom sr = new SecureRandom(); byte[] ivBytes = new byte[16], keyBytes = new byte[16]; sr.nextBytes(ivBytes); sr.nextBytes(keyBytes); final File tmpFile = TempFile.createTempFile("protectedXlsx", ".zip"); copyToFile(is, tmpFile, keyBytes, ivBytes); IOUtils.closeQuietly(is); return fileToSource(tmpFile, keyBytes, ivBytes); }
/** * Write out this workbook to an OutputStream. * * @param stream - the java OutputStream you wish to write to * @exception IOException if anything can't be written. */ @Override public void write(OutputStream stream) throws IOException { flushSheets(); //Save the template File tmplFile = TempFile.createTempFile("poi-sxssf-template", ".xlsx"); boolean deleted; try { try (FileOutputStream os = new FileOutputStream(tmplFile)) { _wb.write(os); } //Substitute the template entries with the generated sheet data files try (ZipSecureFile zf = new ZipSecureFile(tmplFile); ZipFileZipEntrySource source = new ZipFileZipEntrySource(zf)) { injectData(source, stream); } } finally { deleted = tmplFile.delete(); } if(!deleted) { throw new IOException("Could not delete temporary file after processing: " + tmplFile); } }
File tempFile = TempFile.createTempFile(tempFileName, ".tmp");
/** * @return temp file to write sheet data */ @Override public File createTempFile() throws IOException { return TempFile.createTempFile("poi-sxssf-sheet-xml", ".gz"); }
/** * Create a temp file to write sheet data. * By default, temp files are created in the default temporary-file directory * with a prefix "poi-sxssf-sheet" and suffix ".xml". Subclasses can override * it and specify a different temp directory or filename or suffix, e.g. <code>.gz</code> * * @return temp file to write sheet data */ public File createTempFile() throws IOException { return TempFile.createTempFile("poi-sxssf-sheet", ".xml"); }
protected StandardCipherOutputStream(DirectoryNode dir) throws IOException { this(dir, TempFile.createTempFile("encrypted_package", "crypt")); }
/** * Creates an empty file in the default temporary-file directory, */ public static File createTempFile() { File file = TempFile.createTempFile("poi-ooxml-", ".tmp"); //there is no way to pass an existing file to Package.create(file), //delete first, the file will be re-created in Packe.create(file) file.delete(); return file; }
public MSExcelOOXMLSignUtil(OutputStream finalOutputStream) throws IOException { this.finalOutputStream=finalOutputStream; LOG.info("Creating tempfile for signing"); // create temporary outoputfile this.tempSignFile=TempFile.createTempFile("hadooffice-poi-temp-data-sign",".tmp"); this.tempSignFileOS=new FileOutputStream(this.tempSignFile); }
public EncryptedTempData() throws IOException { SecureRandom sr = new SecureRandom(); ivBytes = new byte[16]; byte[] keyBytes = new byte[16]; sr.nextBytes(ivBytes); sr.nextBytes(keyBytes); skeySpec = new SecretKeySpec(keyBytes, cipherAlgorithm.jceId); tempFile = TempFile.createTempFile("poi-temp-data", ".tmp"); }
public ChunkedCipherOutputStream(DirectoryNode dir, int chunkSize) throws IOException, GeneralSecurityException { super(null); this.chunkSize = chunkSize; int cs = chunkSize == STREAMING ? 4096 : chunkSize; this.chunk = IOUtils.safelyAllocate(cs, MAX_RECORD_LENGTH); this.plainByteFlags = new BitSet(cs); this.chunkBits = Integer.bitCount(cs-1); this.fileOut = TempFile.createTempFile("encrypted_package", "crypt"); this.fileOut.deleteOnExit(); this.out = new FileOutputStream(fileOut); this.dir = dir; this.cipher = initCipherForBlock(null, 0, false); }
public EncryptedTempData(CipherAlgorithm ca, ChainingMode cm) throws IOException { // generate random key for temnporary files if (ca!=null) { SecureRandom sr = new SecureRandom(); byte[] iv = new byte[ca.blockSize]; byte[] key = new byte[ca.defaultKeySize/8]; sr.nextBytes(iv); sr.nextBytes(key); SecretKeySpec skeySpec = new SecretKeySpec(key,ca.jceId); this.ca = ca; this.cm = cm; if (this.cm.jceId.equals(ChainingMode.ecb.jceId)) { // does not work with Crpyto Functions since it does not require IV this.cm=ChainingMode.cbc; } this.ciEncrypt=CryptoFunctions.getCipher(skeySpec, ca, cm, iv, Cipher.ENCRYPT_MODE,"PKCS5Padding"); this.ciDecrypt=CryptoFunctions.getCipher(skeySpec, ca, cm, iv, Cipher.DECRYPT_MODE,"PKCS5Padding"); } this.tempFile=TempFile.createTempFile("hadooffice-poi-temp-data",".tmp"); }
public static AesZipFileZipEntrySource createZipEntrySource(InputStream is) throws IOException { // generate session key SecureRandom sr = new SecureRandom(); byte[] ivBytes = new byte[16], keyBytes = new byte[16]; sr.nextBytes(ivBytes); sr.nextBytes(keyBytes); final File tmpFile = TempFile.createTempFile("protectedXlsx", ".zip"); copyToFile(is, tmpFile, keyBytes, ivBytes); IOUtils.closeQuietly(is); return fileToSource(tmpFile, keyBytes, ivBytes); }
this.tempFile = TempFile.createTempFile("hadooffice-poi-temp-sst", ".tmp"); this.tempFileSize = 0L;
/** * Write out this workbook to an OutputStream. * * @param stream - the java OutputStream you wish to write to * @exception IOException if anything can't be written. */ @Override public void write(OutputStream stream) throws IOException { flushSheets(); //Save the template File tmplFile = TempFile.createTempFile("poi-sxssf-template", ".xlsx"); boolean deleted; try { try (FileOutputStream os = new FileOutputStream(tmplFile)) { _wb.write(os); } //Substitute the template entries with the generated sheet data files try (ZipSecureFile zf = new ZipSecureFile(tmplFile); ZipFileZipEntrySource source = new ZipFileZipEntrySource(zf)) { injectData(source, stream); } } finally { deleted = tmplFile.delete(); } if(!deleted) { throw new IOException("Could not delete temporary file after processing: " + tmplFile); } }
File f = TempFile.createTempFile("CopyOfPOIFileSystem-", ".ole2"); f.deleteOnExit(); copyFileName = f.getAbsolutePath();