org.apache.openejb.loader.IO.write()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(9.2k)|赞(0)|评价(0)|浏览(142)

本文整理了Java中org.apache.openejb.loader.IO.write()方法的一些代码示例,展示了IO.write()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。IO.write()方法的具体详情如下:
包路径:org.apache.openejb.loader.IO
类名称:IO
方法名:write

IO.write介绍

暂无

代码示例

代码示例来源:origin: org.apache.openejb/openejb-loader

  1. public static ZipOutputStream zip(final File file) throws IOException {
  2. final OutputStream write = write(file);
  3. return new ZipOutputStream(write);
  4. }

代码示例来源:origin: org.apache.tomee/openejb-loader

  1. public static ZipOutputStream zip(final File file) throws IOException {
  2. final OutputStream write = write(file);
  3. return new ZipOutputStream(write);
  4. }

代码示例来源:origin: org.apache.openejb/openejb-core

  1. public static void record() {
  2. try {
  3. final File file = new File("/tmp/trace.html");
  4. final OutputStream write = IO.write(file);
  5. report(write);
  6. } catch (final FileNotFoundException e) {
  7. e.printStackTrace();
  8. }
  9. }

代码示例来源:origin: org.apache.tomee/openejb-core

  1. public static void record() {
  2. try {
  3. final File file = new File("/tmp/trace.html");
  4. final OutputStream write = IO.write(file);
  5. report(write);
  6. } catch (final FileNotFoundException e) {
  7. e.printStackTrace();
  8. }
  9. }

代码示例来源:origin: org.apache.openejb/openejb-loader

  1. public static void copy(final InputStream from, final File to, final boolean append) throws IOException {
  2. final OutputStream write = write(to, append);
  3. try {
  4. copy(from, write);
  5. } finally {
  6. close(write);
  7. }
  8. }

代码示例来源:origin: org.apache.tomee/openejb-loader

  1. public static void copy(final InputStream from, final File to) throws IOException {
  2. final OutputStream write = write(to);
  3. try {
  4. copy(from, write);
  5. } finally {
  6. close(write);
  7. }
  8. }

代码示例来源:origin: org.apache.openejb/openejb-loader

  1. public static void copy(final InputStream from, final File to) throws IOException {
  2. final OutputStream write = write(to);
  3. try {
  4. copy(from, write);
  5. } finally {
  6. close(write);
  7. }
  8. }

代码示例来源:origin: org.apache.openejb/openejb-core

  1. private void installLoggingPropertiesFile(final File loggingPropertiesFile) throws IOException {
  2. final String name = STANDALONE_PROPERTIES_FILE + LOGGING_PROPERTIES_FILE;
  3. final URL resource = Thread.currentThread().getContextClassLoader().getResource(name);
  4. if (resource == null) {
  5. System.err.println("FATAL ERROR WHILE CONFIGURING LOGGING!!!. MISSING RESOURCE " + name);
  6. return;
  7. }
  8. final Properties props = IO.readProperties(resource);
  9. preprocessProperties(props);
  10. final OutputStream out = IO.write(loggingPropertiesFile);
  11. try {
  12. props.store(out, "OpenEJB Default Log4j Configuration");
  13. } finally {
  14. IO.close(out);
  15. }
  16. PropertyConfigurator.configure(props);
  17. }
  18. }

代码示例来源:origin: org.apache.tomee/openejb-loader

  1. public static void copy(final InputStream from, final File to, final boolean append) throws IOException {
  2. final OutputStream write = write(to, append);
  3. try {
  4. copy(from, write);
  5. } finally {
  6. close(write);
  7. }
  8. }

代码示例来源:origin: org.apache.tomee/openejb-core

  1. private void installLoggingPropertiesFile(final File loggingPropertiesFile) throws IOException {
  2. final String name = STANDALONE_PROPERTIES_FILE + LOGGING_PROPERTIES_FILE;
  3. final URL resource = Thread.currentThread().getContextClassLoader().getResource(name);
  4. if (resource == null) {
  5. System.err.println("FATAL ERROR WHILE CONFIGURING LOGGING!!!. MISSING RESOURCE " + name);
  6. return;
  7. }
  8. final Properties props = IO.readProperties(resource);
  9. preprocessProperties(props);
  10. final OutputStream out = IO.write(loggingPropertiesFile);
  11. try {
  12. props.store(out, "OpenEJB Default Log4j Configuration");
  13. } finally {
  14. IO.close(out);
  15. }
  16. PropertyConfigurator.configure(props);
  17. }
  18. }

代码示例来源:origin: com.tomitribe.tribestream/tribestream-api-gateway-backbone

  1. private static void installResource(final File conf, final String file) throws IOException {
  2. final URL resource = getResource("/" + file);
  3. IO.copy(IO.read(resource), IO.write(new File(conf, file)));
  4. }

代码示例来源:origin: org.apache.tomee/openejb-core

  1. public void passivate(final Object primaryKey, final Object state) throws SystemException {
  2. try {
  3. final String filename = primaryKey.toString().replace(':', '=');
  4. final File sessionFile = new File(sessionDirectory, filename);
  5. if (!sessionFile.exists() && !sessionFile.createNewFile()) {
  6. throw new Exception("Failed to create passivation file: " + sessionFile.getAbsolutePath());
  7. }
  8. logger.info("Passivating to file " + sessionFile);
  9. try (final OutputStream os = IO.write(sessionFile);
  10. final ObjectOutputStream oos = new ObjectOutputStream(os)) {
  11. oos.writeObject(state);// passivate just the bean instance
  12. } finally {
  13. sessionFile.deleteOnExit();
  14. }
  15. } catch (final NotSerializableException nse) {
  16. logger.error("Passivation failed ", nse);
  17. throw (SystemException) new SystemException("The type " + nse.getMessage() + " is not serializable as mandated by the EJB specification.").initCause(nse);
  18. } catch (final Exception t) {
  19. logger.error("Passivation failed ", t);
  20. throw new SystemException(t);
  21. }
  22. }

代码示例来源:origin: org.apache.tomee/openejb-core

  1. public void passivate(final Object primaryKey, final Object state) throws SystemException {
  2. try {
  3. final String filename = primaryKey.toString().replace(':', '=');
  4. final File sessionFile = new File(sessionDirectory, filename);
  5. logger.info("Passivating to file " + sessionFile);
  6. try (final OutputStream os = IO.write(sessionFile);
  7. final ObjectOutputStream oos = new ObjectOutputStream(os)) {
  8. oos.writeObject(state);// passivate just the bean instance
  9. } finally {
  10. sessionFile.deleteOnExit();
  11. }
  12. } catch (final NotSerializableException nse) {
  13. logger.error("Passivation failed ", nse);
  14. throw (SystemException) new SystemException("The type " + nse.getMessage() + " is not serializable as mandated by the EJB specification.").initCause(nse);
  15. } catch (final Exception t) {
  16. logger.error("Passivation failed ", t);
  17. throw new SystemException(t);
  18. }
  19. }

代码示例来源:origin: org.apache.openejb/openejb-core

  1. private void writeRaXml(final ConnectorModule connectorModule) {
  2. try {
  3. final Connector connector = connectorModule.getConnector();
  4. final File tempFile = tempFile("ra-", connectorModule.getModuleId() + ".xml");
  5. final OutputStream out = IO.write(tempFile);
  6. try {
  7. final JAXBContext ctx = JAXBContextFactory.newInstance(Connector.class);
  8. final Marshaller marshaller = ctx.createMarshaller();
  9. marshaller.marshal(connector, out);
  10. logger.info("Dumping Generated ra.xml to: " + tempFile.getAbsolutePath());
  11. } catch (final JAXBException e) {
  12. // no-op
  13. } finally {
  14. IO.close(out);
  15. }
  16. } catch (final IOException e) {
  17. // no-op
  18. }
  19. }

代码示例来源:origin: org.apache.tomee/openejb-core

  1. private void writeRaXml(final ConnectorModule connectorModule) {
  2. try {
  3. final Connector connector = connectorModule.getConnector();
  4. final File tempFile = tempFile("ra-", connectorModule.getModuleId() + ".xml");
  5. final OutputStream out = IO.write(tempFile);
  6. try {
  7. final JAXBContext ctx = JAXBContextFactory.newInstance(Connector.class);
  8. final Marshaller marshaller = ctx.createMarshaller();
  9. marshaller.marshal(connector, out);
  10. logger.info("Dumping Generated ra.xml to: " + tempFile.getAbsolutePath());
  11. } catch (final JAXBException e) {
  12. // no-op
  13. } finally {
  14. IO.close(out);
  15. }
  16. } catch (final IOException e) {
  17. // no-op
  18. }
  19. }

代码示例来源:origin: org.apache.tomee/openejb-core

  1. private void writeGeronimoOpenejb(final EjbModule ejbModule) {
  2. try {
  3. final GeronimoEjbJarType geronimoEjbJarType = (GeronimoEjbJarType) ejbModule.getAltDDs().get("geronimo-openejb.xml");
  4. if (geronimoEjbJarType == null) {
  5. return;
  6. }
  7. final File tempFile = tempFile("geronimo-openejb-", ejbModule.getModuleId() + ".xml");
  8. final OutputStream out = IO.write(tempFile);
  9. try {
  10. JaxbOpenejbJar2.marshal(GeronimoEjbJarType.class, geronimoEjbJarType, out);
  11. logger.info("Dumping Generated geronimo-openejb.xml to: " + tempFile.getAbsolutePath());
  12. } catch (final JAXBException e) {
  13. // no-op
  14. } finally {
  15. IO.close(out);
  16. }
  17. } catch (final Exception e) {
  18. // no-op
  19. }
  20. }

代码示例来源:origin: org.apache.openejb/openejb-core

  1. private void writeOpenejbJar(final EjbModule ejbModule) {
  2. try {
  3. final OpenejbJar openejbJar = ejbModule.getOpenejbJar();
  4. final File tempFile = tempFile("openejb-jar-", ejbModule.getModuleId() + ".xml");
  5. final OutputStream out = IO.write(tempFile);
  6. try {
  7. JaxbOpenejbJar3.marshal(OpenejbJar.class, openejbJar, out);
  8. logger.info("Dumping Generated openejb-jar.xml to: " + tempFile.getAbsolutePath());
  9. } catch (final JAXBException e) {
  10. // no-op
  11. } finally {
  12. IO.close(out);
  13. }
  14. } catch (final Exception e) {
  15. // no-op
  16. }
  17. }

代码示例来源:origin: org.apache.tomee/openejb-core

  1. private void writeOpenejbJar(final EjbModule ejbModule) {
  2. try {
  3. final OpenejbJar openejbJar = ejbModule.getOpenejbJar();
  4. final File tempFile = tempFile("openejb-jar-", ejbModule.getModuleId() + ".xml");
  5. final OutputStream out = IO.write(tempFile);
  6. try {
  7. JaxbOpenejbJar3.marshal(OpenejbJar.class, openejbJar, out);
  8. logger.info("Dumping Generated openejb-jar.xml to: " + tempFile.getAbsolutePath());
  9. } catch (final JAXBException e) {
  10. // no-op
  11. } finally {
  12. IO.close(out);
  13. }
  14. } catch (final Exception e) {
  15. // no-op
  16. }
  17. }

代码示例来源:origin: org.apache.openejb/openejb-core

  1. private void writeEjbJar(final EjbModule ejbModule) {
  2. try {
  3. final EjbJar ejbJar = ejbModule.getEjbJar();
  4. final File tempFile = tempFile("ejb-jar-", ejbModule.getModuleId() + ".xml");
  5. final OutputStream out = IO.write(tempFile);
  6. try {
  7. EjbJarXml.marshal(ejbJar, out);
  8. logger.info("Dumping Generated ejb-jar.xml to: " + tempFile.getAbsolutePath());
  9. } catch (final JAXBException e) {
  10. // no-op
  11. } finally {
  12. IO.close(out);
  13. }
  14. } catch (final Exception e) {
  15. // no-op
  16. }
  17. }
  18. }

代码示例来源:origin: org.apache.tomee/openejb-core

  1. private void writeEjbJar(final EjbModule ejbModule) {
  2. try {
  3. final EjbJar ejbJar = ejbModule.getEjbJar();
  4. final File tempFile = tempFile("ejb-jar-", ejbModule.getModuleId() + ".xml");
  5. final OutputStream out = IO.write(tempFile);
  6. try {
  7. EjbJarXml.marshal(ejbJar, out);
  8. logger.info("Dumping Generated ejb-jar.xml to: " + tempFile.getAbsolutePath());
  9. } catch (final JAXBException e) {
  10. // no-op
  11. } finally {
  12. IO.close(out);
  13. }
  14. } catch (final Exception e) {
  15. // no-op
  16. }
  17. }
  18. }

相关文章