Package java.io

Examples of java.io.ByteArrayOutputStream.writeTo()


    private void sendContent() throws IOException {
        if (contentBuffer instanceof ByteArrayOutputStream) {
            ByteArrayOutputStream buf = (ByteArrayOutputStream) contentBuffer;
            if (buf.size() > 0)
                buf.writeTo(out);
            contentBuffer = null;
           
        } else if (largeOutputFile != null){
            if (largeOutputFile.length() > 0)
                FileUtils.copyFile(largeOutputFile, out);
View Full Code Here


      //setting the paths for writing the PDF
      String fileName = (String) sess.getAttribute("fileName");
      ServletContext sc = getServletConfig().getServletContext();
      String path = sc.getRealPath("/") + "repository/";
      FileOutputStream out = new FileOutputStream(new File(path+fileName));
      baosPDF.writeTo(out);
      out.flush();
      out.close();

      //redirect to conclusion page
      RequestDispatcher disp = getServletContext().getRequestDispatcher("/finish_1.jsp");
View Full Code Here

            updatedFileContent.close();
        }

        FileOutputStream updatedConfigFile = new FileOutputStream(configFile);
        try {
            cachedUpdatedFileContent.writeTo(updatedConfigFile);
        } finally {
            updatedConfigFile.close();
        }
    }
}
View Full Code Here

      final JavaClass clazz = (JavaClass)classes.nextElement();
      final String className = clazz.getClassName().replace('.','/');
      jos.putNextEntry(new JarEntry(className+".class"));
      final ByteArrayOutputStream out = new ByteArrayOutputStream(2048);
      clazz.dump(out); // dump() closes it's output stream
      out.writeTo(jos);
  }
  jos.close();
    }

    /**
 
View Full Code Here

            leos.write(getDataBuffer());
            leos.writeShort(getFlags3());
            leos.close(); // satisfy compiler ...
           
            leosOut.writeInt(bos.size()); // total size
            bos.writeTo(out);
            break;
        }
        case compact:
            leosOut.writeInt(getDataSize()+LittleEndianConsts.SHORT_SIZE);
            leosOut.writeShort(getFlags1());
View Full Code Here

                    this.serializer.setOutputStream(os);

                    // execute the pipeline:
                    this.generator.generate();
                    environment.setContentLength(os.size());
                    os.writeTo(environment.getOutputStream(0));
                } else {
                    // set the output stream
                    this.serializer.setOutputStream(environment.getOutputStream(this.outputBufferSize));
                    // execute the pipeline:
                    this.generator.generate();
View Full Code Here

            if (this.reader.shouldSetContentLength()) {
                ByteArrayOutputStream os = new ByteArrayOutputStream();
                this.reader.setOutputStream(os);
                this.reader.generate();
                environment.setContentLength(os.size());
                os.writeTo(environment.getOutputStream(0));
            } else {
                this.reader.setOutputStream(environment.getOutputStream(this.outputBufferSize));
                this.reader.generate();
            }
        } catch (Exception e) {
View Full Code Here

                        } else {
                            this.generator.generate();
                        }

                        environment.setContentLength(baos.size());
                        baos.writeTo(os);
                    } else {
                        if (os == null) {
                            os = environment.getOutputStream(this.outputBufferSize);
                        }
View Full Code Here

                    this.reader.generate();
                    environment.setContentLength(os.size());
                    if (outputStream == null) {
                        outputStream = environment.getOutputStream(0);
                    }
                    os.writeTo(outputStream);
                } else {
                    if (outputStream == null) {
                        outputStream = environment.getOutputStream(this.outputBufferSize);
                    }
                    this.reader.setOutputStream(outputStream);
View Full Code Here

                print(ps, "</" + XcpDocumentHandler.PROTOCOL + ">");
            } else {
                Iterator it = this.responseQueue.iterator();
                while(it.hasNext()) {
                    ByteArrayOutputStream b = (ByteArrayOutputStream)it.next();
                    b.writeTo(out);
                }
            }
        } finally {
            try { ps.close()} catch(Exception ex) {}
        }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.