Add missing license headers to packetcable-driver utils
[packetcable.git] / packetcable-driver / src / main / java / org / pcmm / utils / PCMMUtils.java
index 4762370c55d408114bb21679a6b92ed3a8d7e4bc..bdded52fa29a064221cf8e5e593e36a4621ca73a 100644 (file)
@@ -1,8 +1,16 @@
-/**
- @header@
+/*
+ * Copyright (c) 2014, 2015 Cable Television Laboratories, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
+
 package org.pcmm.utils;
 
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
 import java.io.FileInputStream;
 import java.io.FileNotFoundException;
 import java.io.FileOutputStream;
@@ -10,12 +18,14 @@ import java.io.IOException;
 
 public class PCMMUtils {
 
+    public final static Logger logger = LoggerFactory.getLogger(PCMMUtils.class);
+
     public static void WriteBinaryDump(String rootFileName, byte[] buffer) {
         // Make this Unique
         String fileName = "/tmp/" + rootFileName + "-" + java.util.UUID.randomUUID() + ".bin";
         try {
 
-            System.out.println("Open fileName " + fileName);
+            logger.info("Open fileName " + fileName);
             FileOutputStream outputStream = new FileOutputStream(fileName);
 
             // write() writes as many bytes from the buffer
@@ -29,9 +39,9 @@ public class PCMMUtils {
             // Always close files.
             outputStream.close();
 
-            System.out.println("Wrote " + buffer.length + " bytes");
+            logger.info("Wrote " + buffer.length + " bytes");
         } catch (IOException ex) {
-            System.out.println("Error writing file '" + fileName + "'");
+            logger.error("Error writing file '" + fileName + "'", ex);
             // Or we could just do this:
             // ex.printStackTrace();
         }
@@ -53,12 +63,12 @@ public class PCMMUtils {
             // Always close files.
             inputStream.close();
 
-            System.out.println("Read " + total + " bytes");
+            logger.info("Read " + total + " bytes");
             return buffer;
         } catch (FileNotFoundException ex) {
-            System.out.println("Unable to open file '" + fileName + "'");
+            logger.error("Unable to open file '" + fileName + "'", ex);
         } catch (IOException ex) {
-            System.out.println("Error reading file '" + fileName + "'");
+            logger.error("Error reading file '" + fileName + "'", ex);
             // Or we could just do this:
             // ex.printStackTrace();
         }