/** * Write the current workbook to a file * * @param aFile * The file to write to. May not be <code>null</code>. * @return {@link ESuccess} */ @Nonnull public ESuccess writeTo (@Nonnull final File aFile) { return writeTo (FileHelper.getOutputStream (aFile)); }
void save (@Nonnull OutputStream aOS, @Nonnull char [] aPassword) throws OpenAS2Exception; }
protected void writeToFile (@Nonnull final File aDestinationFile, @Nonnull final List <String> aHeaderLines, @Nonnull final byte [] aPayload, @Nullable final IBaseMessage aMsg) { LOGGER.info ("Dumping incoming HTTP request to file " + aDestinationFile.getAbsolutePath ()); try (final OutputStream aOS = FileHelper.getOutputStream (aDestinationFile)) { for (final String sHeaderLine : aHeaderLines) aOS.write ((sHeaderLine + CHttp.EOL).getBytes (CHttp.HTTP_CHARSET)); // empty line aOS.write (CHttp.EOL.getBytes (CHttp.HTTP_CHARSET)); // Add payload aOS.write (aPayload); } catch (final IOException ex) { LOGGER.error ("Failed to dump HTTP request to file " + aDestinationFile.getAbsolutePath () + " and message stub " + aMsg, ex); } }
public static void writeKeyStore (@Nonnull final OpenAS2KeyStore aKeyStore, @Nonnull final String sFilename, @Nonnull final char [] aPassword) throws GeneralSecurityException, IOException { final OutputStream aOS = FileHelper.getOutputStream (new File (sFilename), EAppend.TRUNCATE); if (aOS == null) throw new IllegalArgumentException ("Failed to open KeyStore '" + sFilename + "' for writing"); try { aKeyStore.getKeyStore ().store (aOS, aPassword); } finally { StreamHelper.close (aOS); } }
private static void _dumpDecrypted (@Nonnull final byte [] aPayload) { // Ensure a unique filename File aDestinationFile; int nIndex = 0; do { aDestinationFile = new File (s_aDumpDecryptedDirectory, "as2-decrypted-" + Long.toString (PDTFactory.getCurrentMillis ()) + "-" + nIndex + ".part"); nIndex++; } while (aDestinationFile.exists ()); LOGGER.info ("Dumping decrypted MIME part to file " + aDestinationFile.getAbsolutePath ()); try (final OutputStream aOS = FileHelper.getOutputStream (aDestinationFile)) { // Add payload aOS.write (aPayload); } catch (final IOException ex) { if (LOGGER.isErrorEnabled ()) LOGGER.error ("Failed to dump decrypted MIME part to file " + aDestinationFile.getAbsolutePath (), ex); } }
/** * Write a Micro Node to a file. * * @param aNode * The node to be serialized. May be any kind of node (incl. * documents). May not be <code>null</code>. * @param aFile * The file to write to. May not be <code>null</code>. * @param aSettings * The settings to be used for the creation. May not be * <code>null</code>. * @return {@link ESuccess} */ @Nonnull public static ESuccess writeToFile (@Nonnull final IMicroNode aNode, @Nonnull final File aFile, @Nonnull final IXMLWriterSettings aSettings) { ValueEnforcer.notNull (aFile, "File"); final OutputStream aOS = FileHelper.getOutputStream (aFile); if (aOS == null) return ESuccess.FAILURE; // No need to wrap the OS in a BufferedOutputStream as inside, it is later // on wrapped in a BufferedWriter return writeToStream (aNode, aOS, aSettings); }
aXWS.setNamespaceContext (aNSContext).setPutNamespaceContextPrefixesInRoot (true); final OutputStream aOS = FileHelper.getOutputStream (aXSLTFile); if (aOS == null) throw new IllegalStateException ("Failed to open output stream for file " +
final OutputStream aOS = FileHelper.getOutputStream (aFile); if (aOS == null)
final OutputStream aOS = FileHelper.getOutputStream (aFileNew); if (aOS == null)
final OutputStream aFOS = FileHelper.getOutputStream (aMsgErrorFile); try