Here you can find the source of checkDir(String name)
Parameter | Description |
---|---|
name | directory name |
Parameter | Description |
---|---|
IOException | an exception |
public static File checkDir(String name) throws IOException
//package com.java2s; /*//from ww w . ja v a2s .co m * LingPipe v. 2.0 * Copyright (C) 2003-5 Alias-i * * This program is licensed under the Alias-i Royalty Free License * Version 1 WITHOUT ANY WARRANTY, without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the Alias-i * Royalty Free License Version 1 for more details. * * You should have received a copy of the Alias-i Royalty Free License * Version 1 along with this program; if not, visit * http://www.alias-i.com/lingpipe/licenseV1.txt or contact * Alias-i, Inc. at 181 North 11th Street, Suite 401, Brooklyn, NY 11211, * +1 (718) 290-9170. */ import java.io.File; import java.io.IOException; import java.io.IOException; public class Main { /** * Check if dir exists * * @param name directory name * @throws IOException */ public static File checkDir(String name) throws IOException { File file = new File(name); if (!(file.exists() && file.isDirectory())) { String msg = "No such directory: " + name; throw new IllegalArgumentException(msg); } return file; } }