質問編集履歴

5

コードボタンを最後に押しました

2019/01/17 02:50

投稿

shou_hitotose
shou_hitotose

スコア66

test CHANGED
File without changes
test CHANGED
@@ -20,11 +20,13 @@
20
20
 
21
21
 
22
22
 
23
- ```Java
24
23
 
25
24
 
26
25
 
26
+
27
+ ```Java
28
+
27
- import java.io.*;
29
+ import java.io.*;
28
30
 
29
31
  import java.net.*;
30
32
 
@@ -140,8 +142,10 @@
140
142
 
141
143
  }
142
144
 
143
- } 
145
+ } 
144
146
 
145
147
  ```
146
148
 
149
+
150
+
147
151
  ほんとにわからないのでよろしくお願いいたします。

4

改行を整える

2019/01/17 02:50

投稿

shou_hitotose
shou_hitotose

スコア66

test CHANGED
File without changes
test CHANGED
@@ -24,35 +24,23 @@
24
24
 
25
25
 
26
26
 
27
-   import java.io.*;
27
+ import java.io.*;
28
-
29
-
30
28
 
31
29
  import java.net.*;
32
30
 
33
31
 
34
32
 
35
- public class access {
33
+ public class rp9_2 {
36
-
37
-
38
34
 
39
35
  public static void main(String args[]) {
40
36
 
41
-
42
-
43
37
  try{
44
38
 
45
-
46
-
47
-       
48
-
49
-    ServerSocket ss = new ServerSocket(12354);
39
+ ServerSocket ss = new ServerSocket(12354);
50
40
 
51
41
  while(true) {
52
42
 
53
-
54
-
55
-         Socket s = ss.accept();
43
+ Socket s = ss.accept();
56
44
 
57
45
  InputStream instream = s.getInputStream();
58
46
 
@@ -63,8 +51,6 @@
63
51
 
64
52
 
65
53
  String theLine;
66
-
67
-
68
54
 
69
55
  theLine = bfreader.readLine();
70
56
 
@@ -84,9 +70,9 @@
84
70
 
85
71
  s.close();
86
72
 
87
-                                continue;
73
+ continue;
88
74
 
89
-                            }
75
+ }
90
76
 
91
77
  FileInputStream finstream = new FileInputStream(theFile);
92
78
 
@@ -100,7 +86,7 @@
100
86
 
101
87
  OutputStreamWriter oswriter = new OutputStreamWriter(outstream);
102
88
 
103
- BufferedWriter bfwriter = new BufferedWriter(oswriter);
89
+ BufferedWriter bfwriter = new BufferedWriter(oswriter);
104
90
 
105
91
  PrintWriter pwriter = new PrintWriter(bfwriter);
106
92
 
@@ -108,23 +94,17 @@
108
94
 
109
95
  pwriter.print("HTTP/1.0 200 OK\r\nContent-Type: text/html\r\n\r\n");
110
96
 
111
-
97
+ do {
112
98
 
113
-          do {
114
-
115
-                               theLine = fbfreader.readLine();
99
+ theLine = fbfreader.readLine();
116
100
 
117
101
  if( theLine != null ) {
118
102
 
119
-                        sleep(100);
103
+ sleep(100);
120
104
 
121
-
105
+ pwriter.println(theLine);
122
106
 
123
-
124
-
125
-            pwriter.println(theLine);
126
-
127
-                    pwriter.flush();
107
+ pwriter.flush();
128
108
 
129
109
  }
130
110
 
@@ -132,49 +112,35 @@
132
112
 
133
113
 
134
114
 
135
-         pwriter.flush();
115
+ pwriter.flush();
136
116
 
137
-
138
-
139
-        pwriter.close();
117
+ pwriter.close();
140
118
 
141
119
  }
142
120
 
143
-
121
+ } catch (Exception e) {
144
122
 
145
-       } catch (Exception e) {
123
+ System.err.print(e);
146
124
 
147
-                            System.err.print(e);
125
+ }
148
126
 
149
-
150
-
151
- }
127
+ }
152
-
153
-
154
-
155
- }
156
128
 
157
129
 
158
130
 
159
131
  static void sleep(long msec) {
160
132
 
161
-                       try{
133
+ try{
162
134
 
163
- Thread.sleep(msec);
135
+ Thread.sleep(msec);
164
136
 
165
-        }catch(InterruptedException ie) {
137
+ }catch(InterruptedException ie) {
166
138
 
167
-
139
+ }
168
140
 
169
- }
141
+ }
170
142
 
171
-
172
-
173
- }
143
+ } 
174
-
175
-
176
-
177
- }
178
144
 
179
145
  ```
180
146
 

3

最後に改行を入れる

2019/01/17 02:41

投稿

shou_hitotose
shou_hitotose

スコア66

test CHANGED
File without changes
test CHANGED
@@ -174,6 +174,8 @@
174
174
 
175
175
 
176
176
 
177
+ }
178
+
177
- }```
179
+ ```
178
180
 
179
181
  ほんとにわからないのでよろしくお願いいたします。

2

コードの改行

2019/01/17 02:36

投稿

shou_hitotose
shou_hitotose

スコア66

test CHANGED
File without changes
test CHANGED
@@ -22,7 +22,11 @@
22
22
 
23
23
  ```Java
24
24
 
25
+
26
+
25
- import java.io.*;
27
+   import java.io.*;
28
+
29
+
26
30
 
27
31
  import java.net.*;
28
32
 
@@ -30,15 +34,25 @@
30
34
 
31
35
  public class access {
32
36
 
37
+
38
+
33
39
  public static void main(String args[]) {
40
+
41
+
34
42
 
35
43
  try{
36
44
 
45
+
46
+
47
+       
48
+
37
- ServerSocket ss = new ServerSocket(12354);
49
+    ServerSocket ss = new ServerSocket(12354);
38
50
 
39
51
  while(true) {
40
52
 
53
+
54
+
41
- Socket s = ss.accept();
55
+         Socket s = ss.accept();
42
56
 
43
57
  InputStream instream = s.getInputStream();
44
58
 
@@ -49,6 +63,8 @@
49
63
 
50
64
 
51
65
  String theLine;
66
+
67
+
52
68
 
53
69
  theLine = bfreader.readLine();
54
70
 
@@ -68,9 +84,9 @@
68
84
 
69
85
  s.close();
70
86
 
71
- continue;
87
+                                continue;
72
88
 
73
- }
89
+                            }
74
90
 
75
91
  FileInputStream finstream = new FileInputStream(theFile);
76
92
 
@@ -84,7 +100,7 @@
84
100
 
85
101
  OutputStreamWriter oswriter = new OutputStreamWriter(outstream);
86
102
 
87
- BufferedWriter bfwriter = new BufferedWriter(oswriter);
103
+ BufferedWriter bfwriter = new BufferedWriter(oswriter);
88
104
 
89
105
  PrintWriter pwriter = new PrintWriter(bfwriter);
90
106
 
@@ -92,17 +108,23 @@
92
108
 
93
109
  pwriter.print("HTTP/1.0 200 OK\r\nContent-Type: text/html\r\n\r\n");
94
110
 
95
- do {
111
+
96
112
 
113
+          do {
114
+
97
- theLine = fbfreader.readLine();
115
+                               theLine = fbfreader.readLine();
98
116
 
99
117
  if( theLine != null ) {
100
118
 
101
- sleep(100);
119
+                        sleep(100);
102
120
 
103
- pwriter.println(theLine);
121
+
104
122
 
123
+
124
+
125
+            pwriter.println(theLine);
126
+
105
- pwriter.flush();
127
+                    pwriter.flush();
106
128
 
107
129
  }
108
130
 
@@ -110,34 +132,48 @@
110
132
 
111
133
 
112
134
 
113
- pwriter.flush();
135
+         pwriter.flush();
114
136
 
137
+
138
+
115
- pwriter.close();
139
+        pwriter.close();
116
140
 
117
141
  }
118
142
 
119
- } catch (Exception e) {
143
+
120
144
 
121
- System.err.print(e);
145
+       } catch (Exception e) {
122
146
 
123
- }
147
+                            System.err.print(e);
124
148
 
149
+
150
+
125
- }
151
+ }
152
+
153
+
154
+
155
+ }
126
156
 
127
157
 
128
158
 
129
159
  static void sleep(long msec) {
130
160
 
131
- try{
161
+                       try{
132
162
 
133
- Thread.sleep(msec);
163
+ Thread.sleep(msec);
134
164
 
135
- }catch(InterruptedException ie) {
165
+        }catch(InterruptedException ie) {
136
166
 
137
- }
167
+
138
168
 
139
- }
169
+ }
140
170
 
171
+
172
+
173
+ }
174
+
175
+
176
+
141
- }```
177
+ }```
142
178
 
143
179
  ほんとにわからないのでよろしくお願いいたします。

1

ソースにマークを付ける

2019/01/17 02:30

投稿

shou_hitotose
shou_hitotose

スコア66

test CHANGED
File without changes
test CHANGED
@@ -20,7 +20,7 @@
20
20
 
21
21
 
22
22
 
23
-
23
+ ```Java
24
24
 
25
25
  import java.io.*;
26
26
 
@@ -138,6 +138,6 @@
138
138
 
139
139
  }
140
140
 
141
- }
141
+ }```
142
142
 
143
143
  ほんとにわからないのでよろしくお願いいたします。