1 package com.csss.opensource.jhexdump;
2
3 /***
4 * This class is the abstract class that all JHexDump implementations subclass.
5 *
6 * <p> There are a couple of attributes which are accessile via get/set methods
7 * that will alter the output that are applicable for all implementations of
8 * JHexDump that use the JHexDumpReader class.
9 *
10 * @author Lee Walton
11 * @version 1.1
12 */
13 public abstract class JHexDump {
14
15 /***
16 * BytesPerRow
17 */
18 private int bytesPerRow;
19
20 /***
21 * NoAscii
22 */
23 private boolean noAscii;
24
25 /***
26 * NoPosInd
27 */
28 private boolean noPosInd;
29
30 /***
31 * Public constructor.
32 *
33 * <p>Sets default values for BytesPerRow (16), NoPosInd (false), and
34 * NoAscii (false).
35 */
36 public JHexDump() {
37 setBytesPerRow(16);
38 setNoAscii(false);
39 setNoPosInd(false);
40 }
41
42 /***
43 * Returns the number of bytes to display per row of the hexdump.
44 * <p>The default is 16.
45 *
46 * @return int - BytesPerRow
47 */
48 public int getBytesPerRow() {
49 return bytesPerRow;
50 }
51
52 /***
53 * Sets the number of bytes to display per row of the hexdump.
54 * <p>The default is 16.
55 *
56 * @param bytesPerRow the new value of bytes per row to set
57 */
58 public void setBytesPerRow(int bytesPerRow) {
59 this.bytesPerRow = bytesPerRow;
60 }
61
62 /***
63 * Returns the state of the NoAscii.
64 *
65 * <p>If NoAscii is set to true, then the hexdump will not produce the grid of ascii
66 * displayable characters which appears on the right hand side of the hexdump by
67 * default.
68 *
69 * @return boolean - NoAscii
70 */
71 public boolean isNoAscii() {
72 return noAscii;
73 }
74
75 /***
76 * Toggles the production of the grid of ascii displayable characters on/off.
77 *
78 * <p>If NoAscii is set to true, then the hexdump will not produce the grid of
79 * ascii displayable characters which appears on the right hand side of the
80 * hexdump by default.
81 *
82 * @param noAscii The value of NoAscii to set
83 */
84 public void setNoAscii(boolean noAscii) {
85 this.noAscii = noAscii;
86 }
87
88 /***
89 * Returns the state of the NoPosInd.
90 *
91 * <p>If NoPosInd is set to true, then the hexdump will not produce the position
92 * indicator which appears on the left hand side of the hexdump by default.
93 *
94 * @return boolean NoPosInd
95 */
96 public boolean isNoPosInd() {
97 return noPosInd;
98 }
99
100 /***
101 * Toggles the production of the position indicator on/off.
102 *
103 * <p>If NoPosInd is set to true, then the hexdump will not produce the position
104 * indicator which appears on the left hand side of the hexdump by default.
105 *
106 * @param noPosInd The value of NoPosInd to set
107 */
108 public void setNoPosInd(boolean noPosInd) {
109 this.noPosInd = noPosInd;
110 }
111 }