Package java.io

Examples of java.io.FileOutputStream


    // different one after restart (see AgentServer.init).
    DataOutputStream ldos = null;
    try {
      File tfc = new File(dir, "TFC");
      if (! tfc.exists()) {
        ldos = new DataOutputStream(new FileOutputStream(tfc));
        ldos.writeUTF(getClass().getName());
        ldos.flush();
      }
    } finally {
      if (ldos != null) ldos.close();
View Full Code Here


    // different one after restart (see AgentServer.init).
    DataOutputStream dos = null;
    try {
      File tfc = new File(dir, "TFC");
      if (! tfc.exists()) {
        dos = new DataOutputStream(new FileOutputStream(tfc));
        dos.writeUTF(getClass().getName());
        dos.flush();
      }
    } finally {
      if (dos != null) dos.close();
View Full Code Here

        if (!parentDir.exists()) {
          parentDir.mkdirs();
        }
        file = new File(parentDir, name);
      }
      FileOutputStream fos = new FileOutputStream(file);
      fos.write(buf);
      fos.close();
    }
  }
View Full Code Here

          if (!parentDir.exists()) {
            parentDir.mkdirs();
          }
          file = new File(parentDir, op.name);
        }
        FileOutputStream fos = new FileOutputStream(file);
        fos.write(op.value);
        fos.getFD().sync();
        fos.close();
      } else if (op.type == Operation.DELETE) {
        File file;
        if (op.dirName == null) {
          file = new File(dir, op.name);
          file.delete();
View Full Code Here

  protected File fileRef()
    throws Exception
  {
    InputStream archiveStream ;
    FileOutputStream fileStream ;
    ZipEntry entry ;
    File tempFile ;
   
    if ( this.isInArchive() )
    {
      entry = this.archiveEntry() ;
      archiveStream = this.container().getInputStream( entry ) ;
      tempFile = File.createTempFile( "FLOC_", ".xtr" ) ;
      tempFile.deleteOnExit() ;
      fileStream = new FileOutputStream( tempFile ) ;
      fileUtil().copyStream( archiveStream, fileStream ) ;
      return tempFile ;
    }
    else
    {
View Full Code Here

       + MODEL_FILE_EXTENSION);
      }
      m_Log.statusMessage("Saving model to file...");
     
      try {
  OutputStream os = new FileOutputStream(sFile);
  if (sFile.getName().endsWith(".gz")) {
    os = new GZIPOutputStream(os);
  }
  ObjectOutputStream objectOutputStream = new ObjectOutputStream(os);
  objectOutputStream.writeObject(classifier);
View Full Code Here

                  m_outputFile = file;
                }
              } else {
                m_outputFile = file;
              }
              setDestination(new FileOutputStream(m_outputFile));
            }
        } catch(Exception ex){
            throw new IOException("Cannot create a new output file (Reason: " + ex.toString() + "). Standard out is used.");
        } finally{
            if(!success){
View Full Code Here

   
    if ( scratch_file_is == null || messages_dirty ){
     
      File temp_file = null;
     
      FileOutputStream  fos = null;
     
        // we have a previous cache, discard
     
      if ( scratch_file_is != null ){
       
          // System.out.println( "discard cache file " + scratch_file_name + " for " + this );
       
        try{
          scratch_file_is.close();
                   
        }catch( Throwable e ){ 
         
          scratch_file_name = null;
         
        }finally{
         
          scratch_file_is = null;
        }
      }
     
      try{
        Properties props = new Properties();
       
        props.putAll( messages );
       
        if ( scratch_file_name == null ){
       
          temp_file = AETemporaryFileHandler.createTempFile();
         
        }else{
         
          temp_file = scratch_file_name;
        }
       
        fos = new FileOutputStream( temp_file );
       
        props.store( fos, "message cache" );
       
        fos.close();
       
        fos = null;
       
          // System.out.println( "wrote cache file " + temp_file + " for " + this );
       
        scratch_file_name  = temp_file;
        scratch_file_is   = new FileInputStream( temp_file );
       
        messages_dirty    = false;
       
      }catch( Throwable e ){
       
        if ( fos != null ){
         
          try{
            fos.close();
           
          }catch( Throwable f ){
           
          }
        }
View Full Code Here

        // This will prevent being left with an empty file if a FTPException
        // is thrown by initGet().
        initGet(remoteFile);

        // create the buffered output stream for writing the file
        FileOutputStream out =
                new FileOutputStream(localPath, resume);
       
        try {
            getDataAfterInitGet(out);
        }
        catch (IOException ex) {
View Full Code Here

    }
   
    super.saveChanges();
   
    if (_schema != null) {
        OutputStream out = new FileOutputStream(getSchemaDefinitionFile().getLocation().toFile());
        try {
            _schema.write(out);
        } catch (Exception e) {
            IOException ioe = new IOException("Unable to save design config changes.");
              ioe.setStackTrace(e.getStackTrace());
              throw ioe;
        } finally {
            out.close();
        }
    }
   
    try {
      new WGADesignStructureHelper(_designContainer).enforceDesignEncoding();
View Full Code Here

TOP

Related Classes of java.io.FileOutputStream

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.