Package java.io

Examples of java.io.ByteArrayOutputStream.writeTo()


      response.setContentType("application/pdf");
      // the contentlength is needed for MSIE!!!
      response.setContentLength(baos.size());
      // write ByteArrayOutputStream to the ServletOutputStream
      ServletOutputStream out = response.getOutputStream();
      baos.writeTo(out);
      out.flush();
        }
        catch(Exception e) {
          isError(response.getOutputStream());
        }
View Full Code Here


          ByteArrayOutputStream bout = new ByteArrayOutputStream();
          DataOutputStream dout = new DataOutputStream( bout );
          mode.write( dout, converter );
         
          out.writeInt( bout.size() );
          bout.writeTo( out );
         
          dout.close();
        }
    }
   
View Full Code Here

        COSDictionary streamDict = new COSDictionary();
        streamDict.setInt(COSName.LENGTH, baos.size());
        COSStream output = pdfDocument.getDocument().createCOSStream(streamDict);
        output.setFilters(stream.getFilters());
        OutputStream os = output.createUnfilteredStream();
        baos.writeTo(os);
        os.close();

        return output;
    }
View Full Code Here

    X509Certificate x509cert = (X509Certificate) certs[0];
    String IssuerDN = x509cert.getIssuerDN().toString();
    String SubjectDN = x509cert.getSubjectDN().toString();

    // export the users certificate to file
    buffer.writeTo(certfile);
    buffer.flush();
    buffer.close();
    certfile.close();

    // run shell script, which will also remove the created files
View Full Code Here

    ks.store(buffer, kspassword.toCharArray());

    out.setContentType("application/x-pkcs12");
    out.setHeader("Content-disposition", "filename=" + username + ".p12");
    out.setContentLength(buffer.size());
    buffer.writeTo(out.getOutputStream());
    out.flushBuffer();
    buffer.close();
  }

  private void sendJKSToken(KeyStore ks, String username, String kspassword, HttpServletResponse out) throws Exception {
View Full Code Here

    ks.store(buffer, kspassword.toCharArray());

    out.setContentType("application/octet-stream");
    out.setHeader("Content-disposition", "filename=" + username + ".jks");
    out.setContentLength(buffer.size());
    buffer.writeTo(out.getOutputStream());
    out.flushBuffer();
    buffer.close();
  }

  private void sendPEMTokens(KeyStore ks, String username, String kspassword, HttpServletResponse out) throws Exception {
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

            in.close();

            synchronized (out) {
                String path = ARCHIVE_PATH + "/" + newPath + "/" + file;
                out.putNextEntry(new ZipEntry(path));
                buf.writeTo(out);
                out.closeEntry();
            }
            return true;
        } catch (IOException ioe) {}
        return false;
View Full Code Here

                e.setTime(sourceFile.lastModified());
            }

            synchronized (out) {
                out.putNextEntry(e);
                buf.writeTo(out);
                out.closeEntry();
            }
        }
    }
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.