1 | // assumes hello message has not been read yet |
2 | static DialogIO replaceHelloMessage(final DialogIO io, final S newMsg) { |
3 | io.readLine(); // read old hello msg |
4 | ret new DialogIO() { |
5 | bool sent; |
6 | |
7 | // delegate all but readLineImpl() |
8 | boolean isStillConnected() { ret io.isStillConnected(); } |
9 | boolean isLocalConnection() { ret io.isLocalConnection(); } |
10 | Socket getSocket() { ret io.getSocket(); } |
11 | public void close() ctex { io.close(); } |
12 | void sendLine(String line) { io.sendLine(line); } |
13 | |
14 | String readLineImpl() { |
15 | if (!sent) { |
16 | sent = true; |
17 | ret newMsg; |
18 | } |
19 | ret io.readLine(); |
20 | } |
21 | }; |
22 | } |
download show line numbers debug dex old transpilations
Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1007062 |
Snippet name: | replaceHelloMessage |
Eternal ID of this version: | #1007062/4 |
Text MD5: | ebcb7e489aa57f050e56aff62b0309e8 |
Author: | stefan |
Category: | javax / bots |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2019-07-26 23:22:27 |
Source code size: | 672 bytes / 22 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 473 / 506 |
Version history: | 3 change(s) |
Referenced in: | [show references] |