Package net.solarnetwork.io
Class StreamUtils
java.lang.Object
net.solarnetwork.io.StreamUtils
Stream utilities.
- Since:
- 2.3
- Version:
- 1.0
- Author:
- matt
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intThe "magic bytes" to look for at the start of a GZIP stream. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic InputStreamGet anInputStreamfor a given stream with automatic GZIP detection.
-
Field Details
-
GZIP_MAGIC
public static final int GZIP_MAGICThe "magic bytes" to look for at the start of a GZIP stream.- See Also:
-
-
Constructor Details
-
StreamUtils
public StreamUtils()
-
-
Method Details
-
inputStreamForPossibleGzipStream
Get anInputStreamfor a given stream with automatic GZIP detection.If
inis already aGZIPInputStreamthen it will be returned directly. Otherwise he given stream will be read just enough to determine if it looks like a GZIP stream. If it does, then a newGZIPInputStreamwill be returned.- Parameters:
in- the input stream to wrap- Returns:
- the appropriate input stream, never null
- Throws:
IOException- if any IO error occurs
-