1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package org.apache.mina.transport.serial;
21
22 import org.apache.mina.core.session.AbstractIoSessionConfig;
23 import org.apache.mina.core.session.IoSessionConfig;
24
25
26
27
28
29
30
31 class DefaultSerialSessionConfig extends AbstractIoSessionConfig implements
32 SerialSessionConfig {
33
34 private int receiveThreshold = -1;
35
36 private int inputBufferSize = 8;
37
38 private int outputBufferSize = 8;
39
40 private boolean lowLatency = false;
41
42 public DefaultSerialSessionConfig() {
43
44 }
45
46
47
48
49 @Override
50 protected void doSetAll(IoSessionConfig config) {
51 if (config instanceof SerialSessionConfig) {
52 SerialSessionConfig cfg = (SerialSessionConfig) config;
53 setInputBufferSize(cfg.getInputBufferSize());
54 setReceiveThreshold(cfg.getReceiveThreshold());
55 }
56 }
57
58
59
60
61 public int getInputBufferSize() {
62 return inputBufferSize;
63 }
64
65
66
67
68 public boolean isLowLatency() {
69 return lowLatency;
70 }
71
72
73
74
75 public void setInputBufferSize(int bufferSize) {
76 inputBufferSize = bufferSize;
77 }
78
79
80
81
82 public void setLowLatency(boolean lowLatency) {
83 this.lowLatency = lowLatency;
84 }
85
86
87
88
89 public int getReceiveThreshold() {
90 return receiveThreshold;
91 }
92
93
94
95
96 public void setReceiveThreshold(int bytes) {
97 receiveThreshold = bytes;
98 }
99
100
101
102
103 public int getOutputBufferSize() {
104 return outputBufferSize;
105 }
106
107
108
109
110 public void setOutputBufferSize(int bufferSize) {
111 outputBufferSize = bufferSize;
112
113 }
114 }