Examples of FileOutputStream


Examples of java.io.FileOutputStream

        // draw image centered in panel
        g2d.drawImage(old_img, 0, 0, null);
        // Reset to Original
        g2d.setTransform(origXform);

        FileOutputStream out = new FileOutputStream("D:\\test.jpg");
        try{
          ImageIO.write(new_img, "JPG", out);
        }finally{
          out.close();
        }
       
  }
View Full Code Here

Examples of java.io.FileOutputStream

        } catch (InterruptedException e) {
          break;
        }
      }
      else if(f.createNewFile()){
        FileOutputStream fos = new FileOutputStream(f);
        try{
          mail.writeTo(fos);
          return f.getPath();
        }finally{
          fos.close();
        }
      }
      break;
    }while(tryCount < 10);
   
View Full Code Here

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

Examples of java.io.FileOutputStream

    // 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

Examples of java.io.FileOutputStream

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

Examples of java.io.FileOutputStream

          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

Examples of java.io.FileOutputStream

  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

Examples of java.io.FileOutputStream

       + 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

Examples of java.io.FileOutputStream

                  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

Examples of java.io.FileOutputStream

   
    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
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.