public static void move(File from, File to, boolean overwrite) throws IOException { if (to.exists()){ if (overwrite){ if (!to.delete()){ throw new IOException( MessageFormat.format( labels.getString("deleteerror"), new String[] { to.toString() } ) ); } } else { throw new IOException( MessageFormat.format( labels.getString("alreadyexistserror"), new String[] { to.toString() } ) ); } }  if (from.renameTo(to)) return;  InputStream in = null; OutputStream out = null; try { in = new FileInputStream(from); out = new FileOutputStream(to); copy(in, out); in.close(); in = null; out.flush(); out.close(); out = null; if (!from.delete()){ throw new IOException( MessageFormat.format( labels.getString("deleteoriginalerror"), new String[] { from.toString(), to.toString() } ) ); } } finally { if (in != null){ try { in.close(); } catch (IOException ignore){ } in = null; } if (out != null){ try { out.flush(); out.close(); } catch (IOException ignore){ } out = null; } }
public static void move(File from, File to) throws IOException { move(from, to, false);
	public static void move(File from, File to, boolean overwrite) throws IOException {		if (to.exists()){			if (overwrite){				if (!to.delete()){					throw new IOException(						MessageFormat.format(							labels.getString("deleteerror"),							new String[] {								to.toString()							}						)					);				}			} else {				throw new IOException(					MessageFormat.format(						labels.getString("alreadyexistserror"),						new String[] {							to.toString()						}					)				);			}		}		if (from.renameTo(to)) return;		InputStream in = null;		OutputStream out = null;		try {			in = new FileInputStream(from);			out = new FileOutputStream(to);			copy(in, out);			in.close();			in = null;			out.flush();			out.close();			out = null;			if (!from.delete()){				throw new IOException(					MessageFormat.format(						labels.getString("deleteoriginalerror"),						new String[] {							from.toString(),							to.toString()						}					)				);			}		} finally {			if (in != null){				try {					in.close();				} catch (IOException ignore){				}				in = null;			}			if (out != null){				try {					out.flush();					out.close();				} catch (IOException ignore){				}				out = null;			}		}	}