Package java.io

Examples of java.io.ByteArrayOutputStream.writeTo()


            } else {
                tempFile = FileUtils.createTempFile("cos", "tmp", outputDir, false);
            }
           
            currentStream = new BufferedOutputStream(new FileOutputStream(tempFile));
            bout.writeTo(currentStream);
            inmem = false;
            streamList.add(currentStream);
        } catch (Exception ex) {
            //Could be IOException or SecurityException or other issues.
            //Don't care what, just keep it in memory.
View Full Code Here


                    // Store data into a byte[]
                    ByteArrayOutputStream bos = new ByteArrayOutputStream(128 * 1024);
                    readWithZipStats(in, header, ze, bos);
                    zOut.putNextEntry(ze);
                    if (read > 0) zOut.write(header, 0, read);
                    bos.writeTo( zOut);
                }
            }
        }
    }

View Full Code Here

      if (v4A)
      {
         buffer.write(host.getBytes("8859_1")); // host name
         buffer.write(0); // terminating 0
      }
      buffer.writeTo(out);

      // read response

      int version = inp.read();
      if (version == -1)
View Full Code Here

      buffer.write(5); // version
      buffer.write(2); // number of verification methods
      buffer.write(NO_AUTH); // method: no authentication
      buffer.write(USERPWD); // method: username/password
      // buffer.write(GSSAPI); // method: gssapi
      buffer.writeTo(out);

      // receive servers repsonse

      version = inp.read();
      if (version == -1)
View Full Code Here

      buffer.write(DMNAME); // address type
      buffer.write(host.length() & 0xff); // address length
      buffer.write(host.getBytes("8859_1")); // address
      buffer.write((port >> 8) & 0xff); // port
      buffer.write(port & 0xff);
      buffer.writeTo(out);

      // read response

      version = inp.read();
      if (version != 5)
View Full Code Here

               OutputStream sock_out = sock.getOutputStream();
               if (haveMSLargeWritesBug)
                  sock_out = new MSLargeWritesBugStream(sock_out);

               hdr_buf.writeTo(sock_out);

               // Wait for "100 Continue" status if necessary

               try
               {
View Full Code Here

         if (log.isDebugEnabled())
            log.debug("Sending SSL-Tunneling Subrequest");

         // send CONNECT

         hdr_buf.writeTo(sock[0].getOutputStream());

         // return if successful

         resp = new Response(connect, sock[0].getInputStream());
         if (resp.getStatusCode() == 200)
View Full Code Here

            writer.write(" ");
        }
        writer.write("\015\012");
        writer.close();
        OutputStream out = res.getOutputStream();
        buf.writeTo(out);

    }

    /**
     * extract the posted data from an incoming request, stripping away a piggybacked data
View Full Code Here

      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 e2) {
      System.out.println("Error in " + getClass().getName() + "\n" + e2);
    }
View Full Code Here

        e.printStackTrace();
      }
      resp.setContentType("application/pdf");

      resp.setContentLength(baos.size());
      baos.writeTo(out);
      out.flush();
      break;
    }
    }
  }
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.