Skip to content

Instantly share code, notes, and snippets.

@donaldmunro
donaldmunro / ExampleClassRoot.java
Created July 18, 2012 11:11
MyBatis Generator plugin to give query Example classes a common root class.
/*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@donaldmunro
donaldmunro / copyFile
Created June 20, 2012 09:51 — forked from mrenouf/copyFile
Efficient file copy in Java (pre-JDK7)
public static void copyFile(File sourceFile, File destFile, final boolean isOverwrite) throws IOException {
if (destFile.isDirectory())
destFile = new File(destFile, sourceFile.getName());
if (destFile.exists())
{
if (isOverwrite)
destFile.delete();
else
throw new IOException(destFile.getAbsolutePath() + " exists");
}