Add optional lz4 compression for snapshots
[controller.git] / opendaylight / md-sal / sal-clustering-commons / src / main / java / org / opendaylight / controller / cluster / io / PlainInputOutputStreamSupport.java
1 /*
2  * Copyright (c) 2020 PANTHEON.tech, s.r.o. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8 package org.opendaylight.controller.cluster.io;
9
10 import com.google.common.io.ByteSource;
11 import java.io.File;
12 import java.io.IOException;
13 import java.io.InputStream;
14 import java.io.OutputStream;
15 import org.eclipse.jdt.annotation.NonNull;
16
17 final class PlainInputOutputStreamSupport extends InputOutputStreamFactory {
18     static final @NonNull PlainInputOutputStreamSupport INSTANCE = new PlainInputOutputStreamSupport();
19
20     private PlainInputOutputStreamSupport() {
21         // Hidden on purpose
22     }
23
24     @Override
25     public InputStream createInputStream(final ByteSource input) throws IOException {
26         return input.openBufferedStream();
27     }
28
29     @Override
30     public InputStream createInputStream(final File file) throws IOException {
31         return defaultCreateInputStream(file);
32     }
33
34     @Override
35     public OutputStream createOutputStream(final File file) throws IOException {
36         return defaultCreateOutputStream(file);
37     }
38
39     @Override
40     public OutputStream wrapOutputStream(final OutputStream output) throws IOException {
41         return output;
42     }
43 }

©2013 OpenDaylight, A Linux Foundation Collaborative Project. All Rights Reserved.
OpenDaylight is a registered trademark of The OpenDaylight Project, Inc.
Linux Foundation and OpenDaylight are registered trademarks of the Linux Foundation.
Linux is a registered trademark of Linus Torvalds.