code: public static void checkGetOutputStreamOK(Resource resource) throws IOException {
  	if (resource.exists() && !resource.isWriteable()) {
  	    throw new IOException("can't write to file [" + resource.getPath() + "],file is readonly");
  	}
  	if (resource.isDirectory()) throw new IOException("can't write directory [" + resource.getPath() + "] as a file");
  	if (!resource.getParentResource().exists())
  	    throw new IOException("can't write file [" + resource.getPath() + "] as a file, missing parent directory [" + resource.getParent() + "]");
      }
docs: check if getting a outputstream of the file is ok with the rules for the Resource interface, to
  not change this rules.
  
  @param resource
  @throws IOException