Tabnine Logo
IOUtils.closeQuietly
Code IndexAdd Tabnine to your IDE (free)

How to use
closeQuietly
method
in
org.microemu.app.util.IOUtils

Best Java code snippets using org.microemu.app.util.IOUtils.closeQuietly (Showing top 15 results out of 315)

origin: org.microemu/microemu-javase

public static void copyToFile(InputStream is, File dst) throws IOException {
  FileOutputStream fos = null;
  try {
    fos = new FileOutputStream(dst);
    byte[] buf = new byte[1024]; 
    int i = 0;
    while ((i = is.read(buf)) != -1) { 
      fos.write(buf, 0, i);
    }
  } finally {
    closeQuietly(fos);	
  }
}

origin: org.microemu/microemu-javase

public static void copyFile(File src, File dst) throws IOException {
  FileInputStream fis = null;
  try {
    fis = new FileInputStream(src);
    copyToFile(fis, dst);
  } finally {
    closeQuietly(fis); 
  }
}

origin: org.microemu/microemu-javase

private static void saveDevice(XMLElement doc) {
  File configFile = new File(".", "device-tmp.xml");
  FileWriter fw = null;
  try {
    fw = new FileWriter(configFile);
    doc.write(fw);
    fw.close();
  } catch (IOException ex) {
    System.out.println(ex);
  } finally {
    IOUtils.closeQuietly(fw);
  }
}
origin: org.microemu/microemu-javase

IOUtils.closeQuietly(buildVersionInputStream);
IOUtils.closeQuietly(mavenDataInputStream);
origin: org.microemu/microemu-javase-swing

private Image getImage(String str) throws IOException {
  // TODO not always true, there could be some loading images before
  // invoke startApp, right now getCurrentMIDlet returns prevoius MIDlet
  Object midlet = MIDletBridge.getCurrentMIDlet();
  if (midlet == null) {
    midlet = getClass();
  }
  InputStream is = midlet.getClass().getResourceAsStream(str);
  if (is == null) {
    throw new IOException(str + " could not be found.");
  }
  try {
    return getImage(is);
  } finally {
    IOUtils.closeQuietly(is);
  }
}
origin: org.microemu/microemu-javase-swt

private Image getImage(String str) 
    throws IOException 
{
  // TODO not always true, there could be some loading images before
  // invoke startApp, right now getCurrentMIDlet returns prevoius MIDlet
  Object midlet = MIDletBridge.getCurrentMIDlet();
  if (midlet == null) {
    midlet = getClass();
  }
  InputStream is = midlet.getClass().getResourceAsStream(str);
  if (is == null) {
    throw new IOException(str + " could not be found.");
  }
  try {
    return getImage(is);
  } finally {
    IOUtils.closeQuietly(is);
  }
}
origin: org.microemu/microemu-javase

} catch (Throwable ignore) {
} finally {
  IOUtils.closeQuietly(out);
origin: org.microemu/microemu-javase

private static void loadConfigFile(String configFileName) throws IOException {
  File configFile = new File(getConfigPath(), configFileName);
  InputStream is = null;
  String xml = "";
  try {
    InputStream dis = new BufferedInputStream(is = new FileInputStream(configFile));
    while (dis.available() > 0) {
      byte[] b = new byte[dis.available()];
      dis.read(b);
      xml += new String(b);
    }
    configXml = new XMLElement();
    configXml.parseString(xml);
  } catch (XMLParseException e) {
    Logger.error(e);
    createDefaultConfigXml();
  } finally {
    IOUtils.closeQuietly(is);
  }
}
origin: org.microemu/microemu-javase-swing

IOUtils.closeQuietly(jis);
IOUtils.closeQuietly(ijis);
IOUtils.closeQuietly(jos);
origin: org.microemu/microemu-javase

IOUtils.closeQuietly(is);
origin: org.microemu/microemu-javase

public static void saveConfig() {
  urlsMRU.save(configXml.getChildOrNew("files").getChildOrNew("recent"));
  File configFile = new File(getConfigPath(), "config2.xml");
  getConfigPath().mkdirs();
  FileWriter fw = null;
  try {
    fw = new FileWriter(configFile);
    configXml.write(fw);
    fw.close();
  } catch (IOException ex) {
    Logger.error(ex);
  } finally {
    IOUtils.closeQuietly(fw);
  }
}
origin: org.microemu/microemu-javase-swing

  writer.write("</html>\n");
} finally {
  IOUtils.closeQuietly(writer);
origin: org.microemu/microemu-javase

IOUtils.closeQuietly(jis);
IOUtils.closeQuietly(is);
origin: org.microemu/microemu-javase

private static XMLElement loadDeviceDescriptor(ClassLoader classLoader, String descriptorLocation)
    throws IOException {
  InputStream descriptor = classLoader.getResourceAsStream(descriptorLocation);
  if (descriptor == null) {
    throw new IOException("Cannot find descriptor at: " + descriptorLocation);
  }
  XMLElement doc;
  try {
    doc = loadXmlDocument(descriptor);
  } finally {
    IOUtils.closeQuietly(descriptor);
  }
  String parent = doc.getStringAttribute("extends");
  if (parent != null) {
    return inheritXML(loadDeviceDescriptor(classLoader, expandResourcePath(besourceBase(descriptorLocation),
        parent)), doc, "/");
  }
  return doc;
}
origin: org.microemu/microemu-javase

  Message.error("Unable to read MANIFEST", e);
} finally {
  IOUtils.closeQuietly(is);
org.microemu.app.utilIOUtilscloseQuietly

Javadoc

Unconditionally close an InputStream.

Equivalent to InputStream#close(), except any exceptions will be ignored. This is typically used in finally blocks.

Popular methods of IOUtils

  • copyFile
  • getCanonicalFileURL
    Solution for JVM bug http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6351751
  • copyToFile
  • getCanonicalFileClassLoaderURL

Popular in Java

  • Reading from database using SQL prepared statement
  • getApplicationContext (Context)
  • compareTo (BigDecimal)
  • scheduleAtFixedRate (Timer)
  • EOFException (java.io)
    Thrown when a program encounters the end of a file or stream during an input operation.
  • FileOutputStream (java.io)
    An output stream that writes bytes to a file. If the output file exists, it can be replaced or appen
  • InetAddress (java.net)
    An Internet Protocol (IP) address. This can be either an IPv4 address or an IPv6 address, and in pra
  • Properties (java.util)
    A Properties object is a Hashtable where the keys and values must be Strings. Each property can have
  • Queue (java.util)
    A collection designed for holding elements prior to processing. Besides basic java.util.Collection o
  • BasicDataSource (org.apache.commons.dbcp)
    Basic implementation of javax.sql.DataSource that is configured via JavaBeans properties. This is no
  • Top plugins for WebStorm
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now