Package java.io

Examples of java.io.ByteArrayOutputStream.writeTo()


        } else {
            if (inmem) {
                if (currentStream instanceof ByteArrayOutputStream) {
                    ByteArrayOutputStream byteOut = (ByteArrayOutputStream) currentStream;
                    if (copyOldContent && byteOut.size() > 0) {
                        byteOut.writeTo(out);
                    }
                } else if (currentStream instanceof PipedOutputStream) {
                    PipedOutputStream pipeOut = (PipedOutputStream) currentStream;
                    IOUtils.copyAndCloseInput(new PipedInputStream(pipeOut), out);
                } else {
View Full Code Here


        } else {
            tempFile = FileUtils.createTempFile("cos", "tmp", outputDir, false);
        }
       
        currentStream = new BufferedOutputStream(new FileOutputStream(tempFile));
        bout.writeTo(currentStream);
        inmem = false;
        streamList.add(currentStream);
    }

    public File getTempFile() {
View Full Code Here

    private void flush() throws IOException {
      ByteArrayOutputStream buf = getBuffer();
      if (buf.size() == 0) {
        return;                // no data to flush
      }
      buf.writeTo(fp);         // write data to file
      buf.reset();             // erase all data in buf
    }

    void close() throws IOException {
      // close should have been called after all pending transactions
View Full Code Here

        oldbuf = buf2;
      } else {
        oldbuf = buf1;
      }
      long start = FSNamesystem.now();
      oldbuf.writeTo(fp);         // write data to file
      oldbuf.reset();             // erase all data in buf
      fc.force(true);             // sync to persistent store
      long end = FSNamesystem.now();
      totalTimeSync += (end - start);
    }
View Full Code Here

            if (out != null) {
                try {
                    out.close();
                   
                    if(bytes.size() > 0) {
                        bytes.writeTo(new FileOutputStream(outputFilename));
                    }
                } catch (IOException e) {
                    System.err.println("[ERROR] " + e.getMessage());
                    if (verbose){
                        e.printStackTrace();
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

      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

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.