Package java.io

Examples of java.io.BufferedOutputStream


    protected static void unzip(ZipInputStream zin, File f) throws IOException {
        final int BUFFER = 2048;
        FileOutputStream out = new FileOutputStream(f);
        byte[] b = new byte[BUFFER];
        int len = 0;
        BufferedOutputStream dest = new BufferedOutputStream(out, BUFFER);
        while ((len = zin.read(b, 0, BUFFER)) != -1) {
            dest.write(b, 0, len);
        }
        dest.flush();
        dest.close();
    }
View Full Code Here


      throw new HelpException("Error while loading an XML parser", e);
    }

    try {
      log.debug("creating map file [" + mapFile.getPath() + "] ..");
      mapPrinter = new PrintWriter(new BufferedOutputStream(new FileOutputStream(mapFile)));
      mapPrinter.println("<?xml version='1.0' encoding='ISO-8859-1' ?>");
      mapPrinter.println(
        "<!DOCTYPE map PUBLIC \"-//Sun Microsystems Inc.//DTD JavaHelp Map Version 1.0//EN\""
          + " \"http://java.sun.com/products/javahelp/map_1_0.dtd\">\n");
      mapPrinter.println("<!-- Do not change, this file is automatically generated -->");
View Full Code Here

        Exception exception;
        InputStream input = null;
        output = null;
        try {
            input = new BufferedInputStream(srcStream);
            output = new BufferedOutputStream(new FileOutputStream(destFile));
            int ch;
            while ((ch = input.read()) != -1)
                output.write(ch);
        } catch (IOException e) {
            log.error("Error writing stream to file: " + destFile.getAbsolutePath());
View Full Code Here

  /// @throws IOError If an I/O error occurs
  public Any m_openOutput(Context context)
  {
    context.checkWrite(_file.getPath());
    try {
      return new AnyOutputStream(new BufferedOutputStream(
        new FileOutputStream(_file)));
    } catch (IOException e) {
      throw context.exception(e);
    }
  } 
View Full Code Here

      return;
    }
    try {
      _socket = new Socket(_address, _port);
      _input = new GenericInputStream(_socket.getInputStream());
      _output = new PrintStream(new BufferedOutputStream(_socket.getOutputStream()));
    } catch (IOException e) {
      closeConnection();
      throw new RuntimeException("Couldn't establish connection to remote session container: "+e);
    }
  }
View Full Code Here

  /// @method getOutputStream
  /// Gets the output stream of the subprocess.
  /// @synopsis OutputStream getOutputStream()
  public Any m_getOutputStream()
  {
    return new AnyOutputStream(new BufferedOutputStream(_process.getOutputStream()));
  }
View Full Code Here

     * Creates an outputstream to write to
     *
     * @param os The output stream to write to
     */
    public ShpOutputStream(OutputStream os) {
        BufferedOutputStream bos = new BufferedOutputStream(os);
        _leos = new LittleEndianOutputStream(bos);
    }
View Full Code Here

    /**
     * Creates a DbfOutputStream
     */
    public DbfOutputStream(OutputStream os) {
        BufferedOutputStream bos = new BufferedOutputStream(os);
        _leos = new LittleEndianOutputStream(bos);
    }
View Full Code Here

    {
      return;
    }
    try
    {
      final OutputStream out = new BufferedOutputStream(new FileOutputStream(target));
      try
      {
        properties.store(out, FileConfigStorage.CONFIGHEADER);
      }
      finally
      {
        out.close();
      }
    }
    catch (Exception e)
    {
      throw new ConfigStoreException("Failed to write config " + configPath, e); //$NON-NLS-1$
View Full Code Here

    public void save() {
        try {
            file.delete();
           
            FileOutputStream fos = new FileOutputStream(file);
            BufferedOutputStream bos = new BufferedOutputStream(fos);

            int count = 0;
            for (String key : resources.keySet()) {
                String value = key + "=" + resources.get(key) + "\r\n";
                bos.write(value.getBytes("UTF8"));
                count++;
                if (count == 2000) {
                    bos.flush();
                    count = 0;
                }
            }
           
            bos.flush();
            bos.close();
        } catch (Exception e) {
            logger.error("Could not save resources for language " + language, e);
        }
    }
View Full Code Here

TOP

Related Classes of java.io.BufferedOutputStream

Copyright © 2015 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.