1
1
/*
2
- * Copyright 2002-2020 the original author or authors.
2
+ * Copyright 2002-2022 the original author or authors.
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
@@ -100,13 +100,12 @@ private static Part partInternal(HttpHeaders headers, Content content) {
100
100
101
101
102
102
/**
103
- * Abstract base class.
103
+ * Abstract base class for {@link Part} implementations .
104
104
*/
105
105
private static abstract class AbstractPart implements Part {
106
106
107
107
private final HttpHeaders headers ;
108
108
109
-
110
109
protected AbstractPart (HttpHeaders headers ) {
111
110
Assert .notNull (headers , "HttpHeaders is required" );
112
111
this .headers = headers ;
@@ -119,7 +118,6 @@ public String name() {
119
118
return name ;
120
119
}
121
120
122
-
123
121
@ Override
124
122
public HttpHeaders headers () {
125
123
return this .headers ;
@@ -172,7 +170,6 @@ private static class DefaultPart extends AbstractPart {
172
170
173
171
protected final Content content ;
174
172
175
-
176
173
public DefaultPart (HttpHeaders headers , Content content ) {
177
174
super (headers );
178
175
this .content = content ;
@@ -198,7 +195,6 @@ public String toString() {
198
195
return "DefaultPart" ;
199
196
}
200
197
}
201
-
202
198
}
203
199
204
200
@@ -213,7 +209,7 @@ public DefaultFilePart(HttpHeaders headers, Content content) {
213
209
214
210
@ Override
215
211
public String filename () {
216
- String filename = this . headers ().getContentDisposition ().getFilename ();
212
+ String filename = headers ().getContentDisposition ().getFilename ();
217
213
Assert .state (filename != null , "No filename found" );
218
214
return filename ;
219
215
}
@@ -235,7 +231,6 @@ public String toString() {
235
231
return "DefaultFilePart{(" + filename + ")}" ;
236
232
}
237
233
}
238
-
239
234
}
240
235
241
236
@@ -249,22 +244,20 @@ private interface Content {
249
244
Mono <Void > transferTo (Path dest );
250
245
251
246
Mono <Void > delete ();
252
-
253
247
}
254
248
249
+
255
250
/**
256
251
* {@code Content} implementation based on a flux of data buffers.
257
252
*/
258
253
private static final class FluxContent implements Content {
259
254
260
255
private final Flux <DataBuffer > content ;
261
256
262
-
263
257
public FluxContent (Flux <DataBuffer > content ) {
264
258
this .content = content ;
265
259
}
266
260
267
-
268
261
@ Override
269
262
public Flux <DataBuffer > content () {
270
263
return this .content ;
@@ -279,7 +272,6 @@ public Mono<Void> transferTo(Path dest) {
279
272
public Mono <Void > delete () {
280
273
return Mono .empty ();
281
274
}
282
-
283
275
}
284
276
285
277
@@ -292,13 +284,11 @@ private static final class FileContent implements Content {
292
284
293
285
private final Scheduler scheduler ;
294
286
295
-
296
287
public FileContent (Path file , Scheduler scheduler ) {
297
288
this .file = file ;
298
289
this .scheduler = scheduler ;
299
290
}
300
291
301
-
302
292
@ Override
303
293
public Flux <DataBuffer > content () {
304
294
return DataBufferUtils .readByteChannel (
0 commit comments