Examples of FileOutputStream


Examples of java.io.FileOutputStream

        // temp. filename
        tempFile = File.createTempFile("arffviewer", null);
        tempFile.deleteOnExit();
       
        // serialize instances
        oos = new ObjectOutputStream(new BufferedOutputStream(new FileOutputStream(tempFile)));
        oos.writeObject(getInstances());
        oos.flush();
        oos.close();
       
        // add to undo list
View Full Code Here

Examples of java.io.FileOutputStream

        if (ze.isDirectory()) {
          new File(cacheDir, ze.getName()).mkdir();
          continue;
        }
        BufferedOutputStream bo =
          new BufferedOutputStream(new FileOutputStream(new File(cacheDir, ze.getName())));
        while (true) {
          int amountRead = zis.read(buff);
          if (amountRead == -1) {
            break;
          }
View Full Code Here

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

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(clusterer);
View Full Code Here

Examples of java.io.FileOutputStream

          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

Examples of java.io.FileOutputStream

    }
   
    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

Examples of java.io.FileOutputStream

      }
      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

Examples of java.io.FileOutputStream

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

Examples of java.io.FileOutputStream

    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

Examples of java.io.FileOutputStream

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