diff src/org/tn5250j/framework/tn5250/DataStreamProducer.java @ 25:5949eb469a79 tn5250

adding tn5250 files, native android logging
author Carl Byington <carl@five-ten-sg.com>
date Tue, 03 Jun 2014 12:10:21 -0700
parents e8d2a24e85c6
children 294435151b0c
line wrap: on
line diff
--- a/src/org/tn5250j/framework/tn5250/DataStreamProducer.java	Tue Jun 03 11:44:37 2014 -0700
+++ b/src/org/tn5250j/framework/tn5250/DataStreamProducer.java	Tue Jun 03 12:10:21 2014 -0700
@@ -11,11 +11,11 @@
 import java.util.concurrent.BlockingQueue;
 
 import org.tn5250j.encoding.ICodePage;
-import org.tn5250j.tools.logging.TN5250jLogFactory;
-import org.tn5250j.tools.logging.TN5250jLogger;
+import android.util.Log;
+
 
 public class DataStreamProducer implements Runnable {
-
+    private static final String TAG = "DataStreamProducer";
    private BufferedInputStream bin;
    private ByteArrayOutputStream baosin;
    private Thread me;
@@ -28,7 +28,7 @@
    private boolean dumpBytes = false;
    private ICodePage codePage;
 
-   private TN5250jLogger  log = TN5250jLogFactory.getLogger (this.getClass());
+
 
    public DataStreamProducer(tnvt vt, BufferedInputStream in, BlockingQueue<Object> queue, byte[] init) {
       bin = in;
@@ -52,7 +52,7 @@
 
       // load the first response screen
       loadStream(abyte2, 0);
-      
+
       while (!done) {
 		  try {
 
@@ -84,20 +84,20 @@
          }
 
 		 catch (SocketException se) {
-            log.warn("   DataStreamProducer thread interrupted and stopping " + se.getMessage());
+            Log.w(TAG,"   DataStreamProducer thread interrupted and stopping " + se.getMessage());
             done = true;
          }
 
          catch (IOException ioe) {
 
-		   log.warn(ioe.getMessage());
+		   Log.w(TAG,ioe.getMessage());
            if (me.isInterrupted())
               done = true;
 
          }
          catch (Exception ex) {
 
-           log.warn(ex.getMessage());
+           Log.w(TAG,ex.getMessage());
            if (me.isInterrupted())
               done = true;
 
@@ -123,13 +123,13 @@
          saveStream = null;
          inter = null;
          j = (abyte0[i] & 0xff) << 8 | abyte0[i + 1] & 0xff;
-		 log.debug("partial stream found");
+		 Log.d(TAG,"partial stream found");
       }
 
       if (j > size) {
          saveStream = new byte[abyte0.length];
          System.arraycopy(abyte0, 0, saveStream, 0, abyte0.length);
-		 log.debug("partial stream saved");
+		 Log.d(TAG,"partial stream saved");
       }
       else {
          byte abyte1[];
@@ -143,7 +143,7 @@
          }
          catch (Exception ex) {
 
-           log.warn("load stream error " + ex.getMessage());
+           Log.w(TAG,"load stream error " + ex.getMessage());
    //        ex.printStackTrace();
    //        dump(abyte0);
 
@@ -160,9 +160,9 @@
       baosin.reset();
       int j = -1;
       int i = 0;
-      
+
       while(!done) {
-         
+
          i = bin.read();
 
          // WVL - LDC : 16/07/2003 : TR.000345
@@ -257,7 +257,7 @@
             }
          }
          catch (FileNotFoundException fnfe) {
-            log.warn(fnfe.getMessage());
+            Log.w(TAG,fnfe.getMessage());
          }
 
       }
@@ -275,17 +275,17 @@
          }
          catch(IOException ioe) {
 
-            log.warn(ioe.getMessage());
+            Log.w(TAG,ioe.getMessage());
          }
       }
 
-      log.info("Data Stream output is now " + dumpBytes);
+      Log.i(TAG,"Data Stream output is now " + dumpBytes);
    }
 
    public void dump (byte[] abyte0) {
       try {
 
-         log.info("\n Buffer Dump of data from AS400: ");
+         Log.i(TAG,"\n Buffer Dump of data from AS400: ");
          dw.write("\r\n Buffer Dump of data from AS400: ".getBytes());
 
          StringBuffer h = new StringBuffer();
@@ -333,7 +333,7 @@
       }
       catch(EOFException _ex) { }
       catch(Exception _ex) {
-         log.warn("Cannot dump from host\n\r");
+         Log.w(TAG,"Cannot dump from host\n\r");
       }
 
    }