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 class DefaultSerialSessionConfig extends AbstractIoSessionConfig implements
31 SerialSessionConfig {
32
33 private int receiveThreshold = -1;
34
35 private int inputBufferSize = 8;
36
37 private int outputBufferSize = 8;
38
39 private boolean lowLatency = false;
40
41 public DefaultSerialSessionConfig() {
42
43 }
44
45
46
47
48 @Override
49 protected void doSetAll(IoSessionConfig config) {
50 if (config instanceof SerialSessionConfig) {
51 SerialSessionConfig cfg = (SerialSessionConfig) config;
52 setInputBufferSize(cfg.getInputBufferSize());
53 setReceiveThreshold(cfg.getReceiveThreshold());
54 }
55 }
56
57
58
59
60 public int getInputBufferSize() {
61 return inputBufferSize;
62 }
63
64
65
66
67 public boolean isLowLatency() {
68 return lowLatency;
69 }
70
71
72
73
74 public void setInputBufferSize(int bufferSize) {
75 inputBufferSize = bufferSize;
76 }
77
78
79
80
81 public void setLowLatency(boolean lowLatency) {
82 this.lowLatency = lowLatency;
83 }
84
85
86
87
88 public int getReceiveThreshold() {
89 return receiveThreshold;
90 }
91
92
93
94
95 public void setReceiveThreshold(int bytes) {
96 receiveThreshold = bytes;
97 }
98
99
100
101
102 public int getOutputBufferSize() {
103 return outputBufferSize;
104 }
105
106
107
108
109 public void setOutputBufferSize(int bufferSize) {
110 outputBufferSize = bufferSize;
111
112 }
113 }