Package java.io

Examples of java.io.BufferedOutputStream


    Collections.sort(names);

    PrintWriter out = null;
    try
    {
      out = new PrintWriter(new OutputStreamWriter(new BufferedOutputStream(new FileOutputStream(filename))));

      for (int i = 0; i < names.size(); i++)
      {
        final String key = (String) names.get(i);
        final String value = prop.getProperty(key);
View Full Code Here


    OutputStream outputStream = null;
    try
    {
      // Open the output stream
      outputStream = new BufferedOutputStream(new FileOutputStream(outputFile));

      // Generate the report to this output stream
      generateReport(outputType, outputStream);
    }
    finally
View Full Code Here

        bi = (BufferedImage) image;
      else
        bi = Utilities.toBufferedImage(new DcImageIcon(image), -1, -1);
     
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        BufferedOutputStream bos = new BufferedOutputStream(baos);
       
        byte[] bytes = null;
        try {
            ImageIO.write(bi, (type == DcImageIcon._TYPE_JPEG ? "JPG" : "PNG"), bos);
            bos.flush();
            bytes = baos.toByteArray();
            bi.flush();
        } catch (IOException e) {
            logger.error(e, e);
        }
       
        try {
            baos.close();
            bos.close();
        } catch (IOException e) {
            logger.error(e, e);
        }
       
        return bytes;
View Full Code Here

        writeToFile(b, new File(filename));
    }
   
    public static void writeToFile(byte[] b, File file) throws Exception {
        FileOutputStream fos = new FileOutputStream(file);
        BufferedOutputStream bos = new BufferedOutputStream(fos);

        bos.write(b);
        bos.flush();
        bos.close();
    }  
View Full Code Here

            // native code failed to move the file; do it the custom way
            FileInputStream fis = new FileInputStream(currentFile);
            BufferedInputStream bis = new BufferedInputStream(fis);
       
            FileOutputStream fos = new FileOutputStream(newFile);
            BufferedOutputStream bos = new BufferedOutputStream(fos);
           
            int count = 0;
            int b;
            while ((b = bis.read()) > -1) {
                bos.write(b);
                count++;
                if (count == 2000) {
                    bos.flush();
                    count = 0;
                }
            }
           
            bos.flush();
           
            bis.close();
            bos.close();
           
            currentFile.delete();
        }
    }
View Full Code Here

  }

  public static void createStreamTable (final MasterReport report, final String filename)
          throws IOException, ReportProcessingException
  {
    OutputStream fout = new BufferedOutputStream(new FileOutputStream(filename));
    try
    {
      createStreamTable(report, fout);
      fout.close();
      fout = null;
    }
    finally
    {
      if (fout != null)
      {
        try
        {
          fout.close();
        }
        catch(Exception e)
        {
          // ignore
        }
View Full Code Here


  public static void createFlowTable (final MasterReport report, final String filename)
          throws IOException, ReportProcessingException
  {
    OutputStream fout = new BufferedOutputStream(new FileOutputStream(filename));
    try
    {
      createFlowTable(report, fout);
      fout.close();
      fout = null;
    }
    finally
    {
      if (fout != null)
      {
        try
        {
          fout.close();
        }
        catch(Exception e)
        {
          // ignore
        }
View Full Code Here

   *                                   report.
   */
  public static void createPageable (final MasterReport report, final String filename)
          throws IOException, ReportProcessingException
  {
    OutputStream fout = new BufferedOutputStream(new FileOutputStream(filename));
    try
    {
      createPageable(report, fout);
      fout.close();
      fout = null;
    }
    finally
    {
      if (fout != null)
      {
        try
        {
          fout.close();
        }
        catch(Exception e)
        {
          // ignore
        }
View Full Code Here

    if (option == JFileChooser.APPROVE_OPTION)
    {
      OutputStream out = null;
      try
      {
        out = new BufferedOutputStream(new FileOutputStream(fileChooser.getSelectedFile()));
        model.save(out, "ISO-8859-1"); //$NON-NLS-1$
        out.close();
        setStatusText(resources.getString("config-description-editor.save-complete")); //$NON-NLS-1$
      }
      catch (Exception ioe)
View Full Code Here

    private void initWrite() throws IOException {
        if (output == null) {
            try {
                OutputStream out = IOUtils.openFileOutputStream(fileName, false);
                out = new BufferedOutputStream(out, Constants.IO_BUFFER_SIZE);
                output = new BufferedWriter(new OutputStreamWriter(out, characterSet));
            } catch (Exception e) {
                close();
                throw DbException.convertToIOException(e);
            }
View Full Code Here

TOP

Related Classes of java.io.BufferedOutputStream

Copyright © 2018 www.massapicom. 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.