File tree Expand file tree Collapse file tree 1 file changed +25
-27
lines changed
cf-java-logging-support-servlet/src/main/java/com/sap/hcp/cf/logging/servlet/filter Expand file tree Collapse file tree 1 file changed +25
-27
lines changed Original file line number Diff line number Diff line change 7
7
8
8
public class WrappedOutputStream extends ServletOutputStream {
9
9
10
- private long contentLength = -1 ;
11
- private final ServletOutputStream wrappedStream ;
12
-
13
- public WrappedOutputStream (ServletOutputStream out ) {
14
- wrappedStream = out ;
15
- }
16
-
17
- public long getContentLength () {
18
- return contentLength ;
19
- }
20
-
21
- @ Override
22
- public void write (int b ) throws IOException {
23
- wrappedStream .write (b );
24
- incrContentLength (1 );
25
- }
26
-
27
- private void incrContentLength (int i ) {
28
- if (contentLength == -1 ) {
29
- contentLength = i ;
30
- } else {
31
- contentLength += i ;
32
- }
33
- }
10
+ private long contentLength = -1 ;
11
+ private final OutputStream wrappedStream ;
12
+
13
+ public WrappedOutputStream (OutputStream out ) {
14
+ wrappedStream = out ;
15
+ }
16
+
17
+ public long getContentLength () {
18
+ return contentLength ;
19
+ }
20
+
21
+ @ Override
22
+ public void write (int b ) throws IOException {
23
+ wrappedStream .write (b );
24
+ incrContentLength (1 );
25
+ }
26
+
27
+ private void incrContentLength (int i ) {
28
+ if (contentLength == -1 ) {
29
+ contentLength = i ;
30
+ } else {
31
+ contentLength += i ;
32
+ }
33
+ }
34
34
35
35
@ Override
36
36
public void write (byte [] b ) throws IOException {
@@ -51,8 +51,6 @@ public void close() throws IOException {
51
51
52
52
@ Override
53
53
public void flush () throws IOException {
54
- try (OutputStream ostream = wrappedStream ) {
55
- wrappedStream .flush ();
56
- }
54
+ wrappedStream .flush ();
57
55
}
58
56
}
You can’t perform that action at this time.
0 commit comments