applied LGPLv3 and source code formatting.
[vamsas.git] / src / uk / ac / vamsas / client / simpleclient / LockedFileOutputStream.java
index 178c74d..cf2d7aa 100644 (file)
@@ -1,5 +1,23 @@
-/**\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
@@ -15,22 +33,27 @@ import org.apache.commons.logging.LogFactory;
 \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
@@ -58,7 +81,7 @@ public class LockedFileOutputStream extends FileOutputStream {
     super(fdObj);\r
     init();\r
     if (fdObj.valid())\r
-      closed=false;\r
+      closed = false;\r
   }\r
 \r
   /**\r
@@ -80,6 +103,7 @@ public class LockedFileOutputStream extends FileOutputStream {
     super(name, append);\r
     init();\r
   }\r
+\r
   /**\r
    * closes - actually just flushes the stream instead.\r
    */\r
@@ -90,10 +114,9 @@ public class LockedFileOutputStream extends FileOutputStream {
       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
@@ -116,8 +139,6 @@ public class LockedFileOutputStream extends FileOutputStream {
       return null;\r
   }\r
 \r
-\r
-\r
   /**\r
    * @param b\r
    * @param off\r
@@ -155,5 +176,5 @@ public class LockedFileOutputStream extends FileOutputStream {
     else\r
       throw new IOException("write on Closed FileOutputStream");\r
   }\r
-  \r
+\r
 }\r