Here you can find the source of isLockDir(File dir)
Parameter | Description |
---|---|
dir | DOCUMENT ME! |
public static boolean isLockDir(File dir) throws IOException
//package com.java2s; /*//from w w w . j a v a2s .co m * Copyright (C) 2006 Jordi Marqu?s Ferr? * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this software; see the file DUROTY.txt. * * Author: Jordi Marqu?s Ferr? * c/Mallorca 295 principal B 08037 Barcelona Spain * Phone: +34 625397324 */ import java.io.File; import java.io.IOException; public class Main { /** * DOCUMENT ME! */ public static final String FILE_IS_UNLOCK = "is.unlock"; /** * DOCUMENT ME! * * @param dir DOCUMENT ME! * * @return DOCUMENT ME! */ public static boolean isLockDir(File dir) throws IOException { boolean lock = true; if (dir == null) { throw new IOException("The dir is null"); } if (!dir.exists()) { throw new IOException("The dir don't exist"); } if (dir.isDirectory()) { File[] children = dir.listFiles(); if (children == null) { throw new IOException("The dir is empty"); } for (int i = 0; i < children.length; i++) { if (children[i].getName().equals("is.unlock")) { lock = false; break; } } return lock; } else { if (dir.getName().equals(FILE_IS_UNLOCK)) { return false; } else { return true; } } } }