Package java.io

Examples of java.io.FileInputStream


            // if this is the case then it means that a PMML classifier was
            // successfully loaded earlier in the code
            objectInputStream = null;
            xmlInputStream = null;
          } else {
            InputStream is = new FileInputStream(objectInputFileName);
            if (objectInputFileName.endsWith(".gz")) {
              is = new GZIPInputStream(is);
            }
            // load from KOML?
            if (!(objectInputFileName.endsWith(".koml") && KOML.isPresent()) ) {
View Full Code Here


  public void process(DeploymentBuilder builder) {
      // Check if jbossws-cxf.xml is present, and if so, updated the provider implementation class attribute
      File f=new File(builder.getWebInf(), "jbossws-cxf.xml");
     
      if (f.exists()) {
        FileInputStream fis=null;
        FileOutputStream fos=null;
       
        try {
          fis=new FileInputStream(f);
         
          byte[] b=new byte[fis.available()];
          fis.read(b);
         
          String str=new String(b);
         
          fis.close();
          fis = null;
         
          if (str.indexOf("@provider@") != -1) {
            fos=new FileOutputStream(f);
           
            str = str.replaceAll("@provider@", provider.getClass().getName());
           
            fos.write(str.getBytes());
           
            fos.flush();
            fos.close();
           
            fos = null;
          } else {
            // Report error
            System.err.println("jbossws-cxf.xml file does not contain @provider@ field");
          }
         
        } catch (IOException e) {
          throw new RuntimeException("Failed to copy files", e);
        } finally {
          try {
            if (fis != null) fis.close();
          } catch (IOException e) {
          }
          try {
            if (fos != null) fos.close();
          } catch (IOException e) {
View Full Code Here

   * @return byte[]
   * @throws IOException
   */
  protected byte[] readFileToByteArray(File file) throws IOException
  {
    FileInputStream in = null;

    try
    {
      byte[] buffer = new byte[(int) file.length()];
      in = new FileInputStream(file);
      in.read(buffer);

      return buffer;
    }
    finally
    {
      if (in != null)
      {
        try
        {
          in.close();
        }
        catch (IOException e)
        {
        }
      }
View Full Code Here

    if (canUndo()) {
      // load file
      tempFile = (File) m_UndoList.get(m_UndoList.size() - 1);
      try {
        // read serialized data
        ooi = new ObjectInputStream(new BufferedInputStream(new FileInputStream(tempFile)));
        inst = (Instances) ooi.readObject();
        ooi.close();
       
        // set instances
        setInstances(inst);
View Full Code Here

            + "PackageRepository.props");
       
       
        if (repPropsFile.exists()) {
          Properties repProps = new Properties();
          repProps.load(new FileInputStream(repPropsFile));
          repURL = repProps.getProperty("weka.core.wekaPackageRepositoryURL");
        }
      }
     
      if (repURL == null || repURL.length() == 0) {
View Full Code Here

    try {
      Properties expProps = new Properties();
      String explorerProps = getPackageHome().getAbsolutePath()
        + File.separator + installedPackageName + File.separator
        + "Explorer.props";
      BufferedInputStream bi = new BufferedInputStream(new FileInputStream(explorerProps));
      expProps.load(bi);
      bi.close();
      bi = null;
      Set keys = expProps.keySet();
      Iterator keysI = keys.iterator();
View Full Code Here

  }
 
  protected static void processGenericPropertiesCreatorProps(File propsFile) {
    try {
      Properties expProps = new Properties();
      BufferedInputStream bi = new BufferedInputStream(new FileInputStream(propsFile));
      expProps.load(bi);
      bi.close();
      bi = null;
      Properties GPCInputProps = GenericPropertiesCreator.getGlobalInputProperties();
     
View Full Code Here

  }
 
  protected static void processExplorerProps(File propsFile) {
    try {
      Properties expProps = new Properties();
      BufferedInputStream bi = new BufferedInputStream(new FileInputStream(propsFile));
      expProps.load(bi);
      bi.close();
      bi = null;
      Set keys = expProps.keySet();
      Iterator keysI = keys.iterator();
View Full Code Here

 
  protected static void processGUIEditorsProps(File propsFile) {
    GenericObjectEditor.registerEditors();
    try {
      Properties editorProps = new Properties();
      BufferedInputStream bi = new BufferedInputStream(new FileInputStream(propsFile));
      editorProps.load(bi);
      bi.close();
      bi = null;
     
      Enumeration enm = editorProps.propertyNames();
View Full Code Here

      int[] ignoredAtts = null;

      m_Log.statusMessage("Loading model from file...");

      try {
  InputStream is = new FileInputStream(selected);
  if (selected.getName().endsWith(".gz")) {
    is = new GZIPInputStream(is);
  }
  ObjectInputStream objectInputStream = new ObjectInputStream(is);
  clusterer = (Clusterer) objectInputStream.readObject();
View Full Code Here

TOP

Related Classes of java.io.FileInputStream

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.