Package java.io

Examples of java.io.ByteArrayOutputStream.writeTo()


      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


        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

    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

      p.destroy();

            // Write the compiler error messages, if any, to the real stream
            tmpErr.close();
            tmpErr.writeTo(out);
           
  } catch (IOException ioe) {
      return false;

  } catch (InterruptedException ie) {
View Full Code Here

    out.print("</body></html>\n");
    out.close();

    // Flush our buffer to the real servlet output
    OutputStream servletOut = response.getOutputStream();
    baos.writeTo(servletOut);
    servletOut.close();
  }

  /**
   * Print a view of pools to the given output writer.
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

            inStream.write(0);
            inStream.write(0);
  } else if((in.length % 3 ) == 2){
            inStream.write(0);
  }
  inStream.writeTo( MimeUtility.encode(out, "base64")  );
        return out;
    }

    public static String encodeAsString(String plaintext) throws Exception {
        return  encode(plaintext).toString();
View Full Code Here

                // Write the IFD.
                writeDirectory(ifdOffset, fields, nextIFDOffset);

                // Write the image data.
                memoryStream.writeTo(output);

                // Write an extra byte for IFD word alignment if needed.
                if(skipByte) {
                    output.write((byte)0);
                }
View Full Code Here

        writer.write("</html>");
       
        // commit now
        writer.flush();
        response.setContentLength(buf.size()+1000);
        buf.writeTo(out);
       
        buf.reset();
        writer.flush();
        for (int pad=998-buf.size();pad-->0;)
            writer.write(" ");
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.