Mercurial > 510Connectbot
annotate app/src/main/java/org/tn5250j/framework/tn5250/DataStreamDumper.java @ 445:8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
author | Carl Byington <carl@five-ten-sg.com> |
---|---|
date | Mon, 04 Jan 2016 15:52:25 -0800 |
parents | |
children | 5ce5235adde6 |
rev | line source |
---|---|
445
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
1 /** |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
2 * Title: DataStreamDumper.java |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
3 * Copyright: Copyright (c) 2015 |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
4 * Company: |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
5 * |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
6 * @author Martin W. Kirst |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
7 * <p/> |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
8 * Description: |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
9 * <p/> |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
10 * This program is free software; you can redistribute it and/or modify |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
11 * it under the terms of the GNU General Public License as published by |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
12 * the Free Software Foundation; either version 2, or (at your option) |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
13 * any later version. |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
14 * <p/> |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
15 * This program is distributed in the hope that it will be useful, |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
18 * GNU General Public License for more details. |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
19 * <p/> |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
20 * You should have received a copy of the GNU General Public License |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
21 * along with this software; see the file COPYING. If not, write to |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
22 * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
23 * Boston, MA 02111-1307 USA |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
24 */ |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
25 package org.tn5250j.framework.tn5250; |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
26 |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
27 import org.tn5250j.encoding.ICodePage; |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
28 |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
29 import java.io.BufferedOutputStream; |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
30 import java.io.FileNotFoundException; |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
31 import java.io.FileOutputStream; |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
32 import java.io.IOException; |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
33 import java.util.concurrent.atomic.AtomicInteger; |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
34 |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
35 import android.util.Log; |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
36 |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
37 public class DataStreamDumper { |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
38 private static final String TAG = "DataStreamDumper"; |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
39 |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
40 private AtomicInteger counter = new AtomicInteger(0); |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
41 |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
42 private FileOutputStream fw; |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
43 private BufferedOutputStream dw; |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
44 private boolean dumpActive = false; |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
45 private ICodePage codePage; |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
46 |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
47 public void toggleDebug(ICodePage cp) { |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
48 if (codePage == null) codePage = cp; |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
49 |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
50 dumpActive = !dumpActive; |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
51 if (dumpActive) { |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
52 try { |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
53 if (fw == null) { |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
54 fw = new FileOutputStream("log.txt"); |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
55 dw = new BufferedOutputStream(fw); |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
56 } |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
57 } catch (FileNotFoundException fnfe) { |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
58 Log.w(TAG, fnfe.getMessage()); |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
59 } |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
60 |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
61 } else { |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
62 try { |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
63 if (dw != null) dw.close(); |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
64 if (fw != null) fw.close(); |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
65 dw = null; |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
66 fw = null; |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
67 codePage = null; |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
68 } catch (IOException ioe) { |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
69 Log.w(TAG, ioe.getMessage()); |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
70 } |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
71 } |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
72 |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
73 Log.i(TAG, "Data Stream output is now " + dumpActive); |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
74 } |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
75 |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
76 public void dump(byte[] abyte0) { |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
77 if (!dumpActive) return; |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
78 |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
79 try { |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
80 Log.i(TAG, "\n Buffer Dump of data from AS400: "); |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
81 dw.write("\r\n Buffer Dump of data from AS400: ".getBytes()); |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
82 StringBuilder h = new StringBuilder(); |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
83 |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
84 for (int x = 0; x < abyte0.length; x++) { |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
85 if (x % 16 == 0) { |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
86 System.out.println(" " + h.toString()); |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
87 dw.write((" " + h.toString() + "\r\n").getBytes()); |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
88 h.setLength(0); |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
89 h.append("+0000"); |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
90 h.setLength(5 - Integer.toHexString(x).length()); |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
91 h.append(Integer.toHexString(x).toUpperCase()); |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
92 System.out.print(h.toString()); |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
93 dw.write(h.toString().getBytes()); |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
94 h.setLength(0); |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
95 } |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
96 |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
97 char ac = codePage.ebcdic2uni(abyte0[x]); |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
98 |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
99 if (ac < ' ') |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
100 h.append('.'); |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
101 else |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
102 h.append(ac); |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
103 |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
104 if (x % 4 == 0) { |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
105 System.out.print(" "); |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
106 dw.write((" ").getBytes()); |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
107 } |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
108 |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
109 if (Integer.toHexString(abyte0[x] & 0xff).length() == 1) { |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
110 System.out.print("0" + Integer.toHexString(abyte0[x] & 0xff).toUpperCase()); |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
111 dw.write(("0" + Integer.toHexString(abyte0[x] & 0xff).toUpperCase()).getBytes()); |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
112 } |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
113 else { |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
114 System.out.print(Integer.toHexString(abyte0[x] & 0xff).toUpperCase()); |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
115 dw.write((Integer.toHexString(abyte0[x] & 0xff).toUpperCase()).getBytes()); |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
116 } |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
117 } |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
118 |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
119 System.out.println(); |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
120 dw.write("\r\n".getBytes()); |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
121 dw.flush(); |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
122 } |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
123 catch (EOFException _ex) { } |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
124 catch (Exception _ex) { |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
125 Log.w(TAG, "Cannot dump from host\n\r"); |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
126 } |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
127 } |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
128 |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
129 void dumpRaw(byte[] buffer) { |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
130 try { |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
131 String fname = "dump_" + counter.get() + ".data"; |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
132 Log.d(TAG, "Dumping file: " + fname); |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
133 FileOutputStream fos = new FileOutputStream(fname); |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
134 fos.write(buffer); |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
135 fos.close(); |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
136 } |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
137 catch (FileNotFoundException e) { |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
138 e.printStackTrace(); |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
139 } |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
140 catch (IOException e) { |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
141 e.printStackTrace(); |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
142 } |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
143 } |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
144 } |