Package java.io

Examples of java.io.FileOutputStream


      tempFile.deleteOnExit();

      ObjectOutputStream oos =
  new ObjectOutputStream(
  new BufferedOutputStream(
  new FileOutputStream(tempFile)));
   
      oos.writeObject(m_Instances);
      oos.flush();
      oos.close();
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(clusterer);
View Full Code Here

          v.trimToSize();
          XStream.write(saveTo.getAbsolutePath(), v); */
        } else /* binary */ {
          ObjectOutputStream os =
            new ObjectOutputStream(new BufferedOutputStream(
                                   new FileOutputStream(saveTo)));
          os.writeObject(m_Classifier);
          if (m_trainingSet != null) {
            Instances header = new Instances(m_trainingSet, 0);
            os.writeObject(header);
          }
View Full Code Here

    }
   
    static public void toFile(Context context, RgbImage rgb, int nQuality, String szPath)
      throws IOException
    {
       OutputStream os = new FileOutputStream(szPath);
       try {
         Bitmap bmp = toBitmap(rgb);
         Bitmap.CompressFormat format = Bitmap.CompressFormat.JPEG;
         szPath = szPath.toLowerCase();
         if (szPath.endsWith("jpg") || szPath.endsWith("jpeg")) { //$NON-NLS-1$ //$NON-NLS-2$
           format = Bitmap.CompressFormat.JPEG;
         } else if (szPath.endsWith("png")) { //$NON-NLS-1$
           format = Bitmap.CompressFormat.PNG;
         }
         bmp.compress(format, nQuality, os);
       } finally {
         os.close();
       }
    }
View Full Code Here

      }
      file = new File(parentDir, name);
    }

    if (useFileOutputStream ) {
      FileOutputStream fos = new FileOutputStream(file);
      fos.write(content);
      fos.getFD().sync();
      fos.close();
    } else {
      RandomAccessFile raf = new RandomAccessFile(file, "rwd");
      raf.write(content);
      raf.close();                   
    }
View Full Code Here

   */
  public static void updateTextContent(int type, long id, String text){
    if(text==null)
      return;
    String path = getFilePath(type, id);
    FileOutputStream fos = null;
    try{
      File f = new File(path);
      if(!f.getParentFile().exists())
        f.getParentFile().mkdirs();
      fos = new FileOutputStream(f);
      fos.write(text.getBytes());
    }catch(IOException e){
      log.error("Exception occur when writing to " + path, e);
    }finally{
      if(fos!=null){
        try{
          fos.close();
        }catch(Exception e){}
      }
    }
  }
View Full Code Here

    A3CMLConfig a3cmlConfig = AgentServer.getConfig();
    if (AgentServer.getTransaction() instanceof fr.dyade.aaa.util.NullTransaction) {
      // TODO (AF): NullTransaction is not significant.
      String cfgDir = System.getProperty(AgentServer.CFG_DIR_PROPERTY, AgentServer.DEFAULT_CFG_DIR);
      String cfgFile = System.getProperty(AgentServer.CFG_FILE_PROPERTY, AgentServer.DEFAULT_CFG_FILE);
      FileOutputStream fos = new FileOutputStream(new File(cfgDir, cfgFile));
      PrintWriter out = new PrintWriter(fos);
      A3CML.toXML(a3cmlConfig, out);
      out.flush();
      fos.flush();
      fos.getFD().sync();
      out.close();
      fos.close();
    } else {
      a3cmlConfig.save();
    }
  }
View Full Code Here

    String path = uploadPath
        + StringUtils.replace(imgURL.substring(baseURI.length()), "/",
            File.separator);
    File f = new File(path);
    if(f.exists() && f.isFile())
      return new FileOutputStream(f, false);
    return null;
  }
View Full Code Here

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

        } 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

TOP

Related Classes of java.io.FileOutputStream

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.