File tree Expand file tree Collapse file tree 2 files changed +6
-10
lines changed
Chapter06/P138_CustomLambdaFilter/src/main/java/modern/challenge Expand file tree Collapse file tree 2 files changed +6
-10
lines changed Original file line number Diff line number Diff line change @@ -15,17 +15,14 @@ private Converters() {
15
15
throw new AssertionError ("Cannot be instantiated" );
16
16
}
17
17
18
- public static byte [] objectToBytes (Serializable obj ) throws IOException {
18
+ public static byte [] objectToBytes (Serializable obj ) throws IOException {
19
19
20
- ByteArrayOutputStream baos = new ByteArrayOutputStream ();
21
-
22
- try ( ObjectOutputStream ois = new ObjectOutputStream (baos )) {
20
+ try ( ByteArrayOutputStream baos = new ByteArrayOutputStream ();
21
+ ObjectOutputStream ois = new ObjectOutputStream (baos )) {
23
22
ois .writeObject (obj );
24
- }
25
-
26
- baos .close ();
27
-
28
- return baos .toByteArray ();
23
+
24
+ return baos .toByteArray ();
25
+ }
29
26
}
30
27
31
28
public static Object bytesToObject (byte [] bytes , ObjectInputFilter filter )
Original file line number Diff line number Diff line change 1
1
package modern .challenge ;
2
2
3
3
import java .io .IOException ;
4
- import java .io .ObjectInputFilter ;
5
4
import java .io .ObjectInputFilter .Status ;
6
5
import java .util .Arrays ;
7
6
You can’t perform that action at this time.
0 commit comments