-/**\r
+/*\r
+ * This file is part of the Vamsas Client version 0.1. \r
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite, \r
+ * Andrew Waterhouse and Dominik Lindner.\r
+ * \r
+ * Earlier versions have also been incorporated into Jalview version 2.4 \r
+ * since 2008, and TOPALi version 2 since 2007.\r
+ * \r
+ * The Vamsas Client is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ * \r
+ * The Vamsas Client is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
* \r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.\r
*/\r
package uk.ac.vamsas.client.simpleclient;\r
\r
\r
/**\r
* @author Jim\r
- *\r
+ * \r
*/\r
public class LockedFileOutputStream extends FileOutputStream {\r
- private static org.apache.commons.logging.Log log = LogFactory.getLog(LockedFileOutputStream.class);\r
- //FileOutputStream ostream=null;\r
- boolean closed=true;\r
+ private static org.apache.commons.logging.Log log = LogFactory\r
+ .getLog(LockedFileOutputStream.class);\r
+\r
+ // FileOutputStream ostream=null;\r
+ boolean closed = true;\r
+\r
private void init() {\r
FileChannel ch = super.getChannel();\r
- if (ch!=null) {\r
- try { closed = !ch.isOpen();\r
+ if (ch != null) {\r
+ try {\r
+ closed = !ch.isOpen();\r
} catch (Exception e) {\r
- closed=true;\r
- log.debug("Invalid LockedOutputStream marked closed.",e);\r
+ closed = true;\r
+ log.debug("Invalid LockedOutputStream marked closed.", e);\r
}\r
}\r
}\r
+\r
/**\r
* @param file\r
* @throws FileNotFoundException\r
super(fdObj);\r
init();\r
if (fdObj.valid())\r
- closed=false;\r
+ closed = false;\r
}\r
\r
/**\r
super(name, append);\r
init();\r
}\r
+\r
/**\r
* closes - actually just flushes the stream instead.\r
*/\r
log.debug("Marking Lockedoutputstream closed.");\r
} else\r
throw new IOException("Close on already closed FileOutputStream.");\r
- closed=true;\r
+ closed = true;\r
}\r
\r
-\r
/**\r
* @throws IOException\r
* @see java.io.OutputStream#flush()\r
return null;\r
}\r
\r
-\r
-\r
/**\r
* @param b\r
* @param off\r
else\r
throw new IOException("write on Closed FileOutputStream");\r
}\r
- \r
+\r
}\r