Mercurial > 510Connectbot
annotate app/src/main/java/org/tn5250j/framework/tn5250/DataStreamDumper.java @ 477:d7461da8145b stable-1.9.3-9
only bind to the MonitorService for localhost monitor connections
author | Carl Byington <carl@five-ten-sg.com> |
---|---|
date | Sun, 20 Oct 2019 14:47:27 -0700 |
parents | 5ce5235adde6 |
children |
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; |
446 | 33 import java.io.EOFException; |
445
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
34 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
|
35 |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
36 import android.util.Log; |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
37 |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
38 public class DataStreamDumper { |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
39 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
|
40 |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
41 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
|
42 |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
43 private FileOutputStream fw; |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
44 private BufferedOutputStream dw; |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
45 private boolean dumpActive = false; |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
46 private ICodePage codePage; |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
47 |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
48 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
|
49 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
|
50 |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
51 dumpActive = !dumpActive; |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
52 if (dumpActive) { |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
53 try { |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
54 if (fw == null) { |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
55 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
|
56 dw = new BufferedOutputStream(fw); |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
57 } |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
58 } catch (FileNotFoundException fnfe) { |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
59 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
|
60 } |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
61 |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
62 } else { |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
63 try { |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
64 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
|
65 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
|
66 dw = null; |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
67 fw = null; |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
68 codePage = null; |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
69 } catch (IOException ioe) { |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
70 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
|
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 |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
74 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
|
75 } |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
76 |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
77 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
|
78 if (!dumpActive) return; |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
79 |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
80 try { |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
81 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
|
82 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
|
83 StringBuilder h = new StringBuilder(); |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
84 |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
85 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
|
86 if (x % 16 == 0) { |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
87 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
|
88 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
|
89 h.setLength(0); |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
90 h.append("+0000"); |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
91 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
|
92 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
|
93 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
|
94 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
|
95 h.setLength(0); |
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 |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
98 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
|
99 |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
100 if (ac < ' ') |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
101 h.append('.'); |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
102 else |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
103 h.append(ac); |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
104 |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
105 if (x % 4 == 0) { |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
106 System.out.print(" "); |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
107 dw.write((" ").getBytes()); |
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 |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
110 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
|
111 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
|
112 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
|
113 } |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
114 else { |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
115 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
|
116 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
|
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 |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
120 System.out.println(); |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
121 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
|
122 dw.flush(); |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
123 } |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
124 catch (EOFException _ex) { } |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
125 catch (Exception _ex) { |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
126 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
|
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 |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
130 void dumpRaw(byte[] buffer) { |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
131 try { |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
132 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
|
133 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
|
134 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
|
135 fos.write(buffer); |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
136 fos.close(); |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
137 } |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
138 catch (FileNotFoundException e) { |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
139 e.printStackTrace(); |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
140 } |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
141 catch (IOException e) { |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
142 e.printStackTrace(); |
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 } |
8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
145 } |