public final class FileSystemProviderSupport extends Object
FileSystemProvider
s.Modifier and Type | Method and Description |
---|---|
static SeekableByteChannel |
createSeekableByteChannel(InputStream in,
long size)
Creates a
SeekableByteChannel wrapped around an InputStream . |
static SeekableByteChannel |
createSeekableByteChannel(InputStream in,
long size,
long initialPosition)
Creates a
SeekableByteChannel wrapped around an InputStream . |
static SeekableByteChannel |
createSeekableByteChannel(OutputStream out)
Creates a
SeekableByteChannel wrapped around an OutputStream . |
static SeekableByteChannel |
createSeekableByteChannel(OutputStream out,
long initialPosition)
Creates a
SeekableByteChannel wrapped around an OutputStream . |
static boolean |
getBooleanValue(Map<String,?> env,
String property)
Retrieves a required boolean property from a map.
|
static boolean |
getBooleanValue(Map<String,?> env,
String property,
boolean defaultValue)
Retrieves an optional boolean property from a map.
|
static byte |
getByteValue(Map<String,?> env,
String property)
Retrieves a required byte property from a map.
|
static byte |
getByteValue(Map<String,?> env,
String property,
byte defaultValue)
Retrieves an optional byte property from a map.
|
static double |
getDoubleValue(Map<String,?> env,
String property)
Retrieves a required double property from a map.
|
static double |
getDoubleValue(Map<String,?> env,
String property,
double defaultValue)
Retrieves an optional double property from a map.
|
static float |
getFloatValue(Map<String,?> env,
String property)
Retrieves a required float property from a map.
|
static float |
getFloatValue(Map<String,?> env,
String property,
float defaultValue)
Retrieves an optional float property from a map.
|
static int |
getIntValue(Map<String,?> env,
String property)
Retrieves a required int property from a map.
|
static int |
getIntValue(Map<String,?> env,
String property,
int defaultValue)
Retrieves an optional int property from a map.
|
static long |
getLongValue(Map<String,?> env,
String property)
Retrieves a required long property from a map.
|
static long |
getLongValue(Map<String,?> env,
String property,
long defaultValue)
Retrieves an optional long property from a map.
|
static short |
getShortValue(Map<String,?> env,
String property)
Retrieves a required short property from a map.
|
static short |
getShortValue(Map<String,?> env,
String property,
short defaultValue)
Retrieves an optional short property from a map.
|
static <T> T |
getValue(Map<String,?> env,
String property,
Class<T> cls)
Retrieves a required property from a map.
|
static <T> T |
getValue(Map<String,?> env,
String property,
Class<T> cls,
T defaultValue)
Retrieves an optional property from a map.
|
public static SeekableByteChannel createSeekableByteChannel(InputStream in, long size)
SeekableByteChannel
wrapped around an InputStream
.
This SeekableByteChannel
, with an initial position of 0
does not support seeking a specific position, truncating or writing.in
- The InputStream
to wrap.size
- The size of the source of the InputStream
.SeekableByteChannel
.NullPointerException
- If the given InputStream
is null
.IllegalArgumentException
- If the given size of initial position is negative.public static SeekableByteChannel createSeekableByteChannel(InputStream in, long size, long initialPosition)
SeekableByteChannel
wrapped around an InputStream
.
This SeekableByteChannel
does not support seeking a specific position, truncating or writing.in
- The InputStream
to wrap.size
- The size of the source of the InputStream
.initialPosition
- The initial position of the returned SeekableByteChannel
.SeekableByteChannel
.NullPointerException
- If the given InputStream
is null
.IllegalArgumentException
- If the given size of initial position is negative.public static SeekableByteChannel createSeekableByteChannel(OutputStream out)
SeekableByteChannel
wrapped around an OutputStream
.
This SeekableByteChannel
, with an initial position of 0
, does not support seeking a specific position, truncating or reading.out
- The OutputStream
to wrap.SeekableByteChannel
.NullPointerException
- If the given OutputStream
is null
.public static SeekableByteChannel createSeekableByteChannel(OutputStream out, long initialPosition)
SeekableByteChannel
wrapped around an OutputStream
.
This SeekableByteChannel
does not support seeking a specific position, truncating or reading.out
- The OutputStream
to wrap.initialPosition
- The initial position of the returned SeekableByteChannel
.SeekableByteChannel
.NullPointerException
- If the given OutputStream
is null
.IllegalArgumentException
- If the given initial position is negative.public static boolean getBooleanValue(Map<String,?> env, String property)
FileSystemProvider.newFileSystem(URI, Map)
and FileSystemProvider.newFileSystem(Path, Map)
.
It supports values of type Boolean
and String
.env
- The map to retrieve the property from.property
- The name of the property.IllegalArgumentException
- If the property is not present in the given map, or if its value has an incompatible type.public static boolean getBooleanValue(Map<String,?> env, String property, boolean defaultValue)
FileSystemProvider.newFileSystem(URI, Map)
and FileSystemProvider.newFileSystem(Path, Map)
.
It supports values of type Boolean
and String
.env
- The map to retrieve the property from.property
- The name of the property.defaultValue
- The value that should be used if the property is not in the given map.IllegalArgumentException
- If the property's value has an incompatible type.public static byte getByteValue(Map<String,?> env, String property)
FileSystemProvider.newFileSystem(URI, Map)
and FileSystemProvider.newFileSystem(Path, Map)
.
It supports values of type Byte
and String
.env
- The map to retrieve the property from.property
- The name of the property.IllegalArgumentException
- If the property is not present in the given map, or if its value has an incompatible type.public static byte getByteValue(Map<String,?> env, String property, byte defaultValue)
FileSystemProvider.newFileSystem(URI, Map)
and FileSystemProvider.newFileSystem(Path, Map)
.
It supports values of type Byte
and String
.env
- The map to retrieve the property from.property
- The name of the property.defaultValue
- The value that should be used if the property is not in the given map.IllegalArgumentException
- If the property's value has an incompatible type.public static short getShortValue(Map<String,?> env, String property)
FileSystemProvider.newFileSystem(URI, Map)
and FileSystemProvider.newFileSystem(Path, Map)
.
It supports values of type Short
and String
.env
- The map to retrieve the property from.property
- The name of the property.IllegalArgumentException
- If the property is not present in the given map, or if its value has an incompatible type.public static short getShortValue(Map<String,?> env, String property, short defaultValue)
FileSystemProvider.newFileSystem(URI, Map)
and FileSystemProvider.newFileSystem(Path, Map)
.
It supports values of type Short
and String
.env
- The map to retrieve the property from.property
- The name of the property.defaultValue
- The value that should be used if the property is not in the given map.IllegalArgumentException
- If the property's value has an incompatible type.public static int getIntValue(Map<String,?> env, String property)
FileSystemProvider.newFileSystem(URI, Map)
and FileSystemProvider.newFileSystem(Path, Map)
.
It supports values of type Integer
and String
.env
- The map to retrieve the property from.property
- The name of the property.IllegalArgumentException
- If the property is not present in the given map, or if its value has an incompatible type.public static int getIntValue(Map<String,?> env, String property, int defaultValue)
FileSystemProvider.newFileSystem(URI, Map)
and FileSystemProvider.newFileSystem(Path, Map)
.
It supports values of type Integer
and String
.env
- The map to retrieve the property from.property
- The name of the property.defaultValue
- The value that should be used if the property is not in the given map.IllegalArgumentException
- If the property's value has an incompatible type.public static long getLongValue(Map<String,?> env, String property)
FileSystemProvider.newFileSystem(URI, Map)
and FileSystemProvider.newFileSystem(Path, Map)
.
It supports values of type Long
and String
.env
- The map to retrieve the property from.property
- The name of the property.IllegalArgumentException
- If the property is not present in the given map, or if its value has an incompatible type.public static long getLongValue(Map<String,?> env, String property, long defaultValue)
FileSystemProvider.newFileSystem(URI, Map)
and FileSystemProvider.newFileSystem(Path, Map)
.
It supports values of type Long
and String
.env
- The map to retrieve the property from.property
- The name of the property.defaultValue
- The value that should be used if the property is not in the given map.IllegalArgumentException
- If the property's value has an incompatible type.public static float getFloatValue(Map<String,?> env, String property)
FileSystemProvider.newFileSystem(URI, Map)
and FileSystemProvider.newFileSystem(Path, Map)
.
It supports values of type Float
and String
.env
- The map to retrieve the property from.property
- The name of the property.IllegalArgumentException
- If the property is not present in the given map, or if its value has an incompatible type.public static float getFloatValue(Map<String,?> env, String property, float defaultValue)
FileSystemProvider.newFileSystem(URI, Map)
and FileSystemProvider.newFileSystem(Path, Map)
.
It supports values of type Float
and String
.env
- The map to retrieve the property from.property
- The name of the property.defaultValue
- The value that should be used if the property is not in the given map.IllegalArgumentException
- If the property's value has an incompatible type.public static double getDoubleValue(Map<String,?> env, String property)
FileSystemProvider.newFileSystem(URI, Map)
and FileSystemProvider.newFileSystem(Path, Map)
.
It supports values of type Double
and String
.env
- The map to retrieve the property from.property
- The name of the property.IllegalArgumentException
- If the property is not present in the given map, or if its value has an incompatible type.public static double getDoubleValue(Map<String,?> env, String property, double defaultValue)
FileSystemProvider.newFileSystem(URI, Map)
and FileSystemProvider.newFileSystem(Path, Map)
.
It supports values of type Double
and String
.env
- The map to retrieve the property from.property
- The name of the property.defaultValue
- The value that should be used if the property is not in the given map.IllegalArgumentException
- If the property's value has an incompatible type.public static <T> T getValue(Map<String,?> env, String property, Class<T> cls)
FileSystemProvider.newFileSystem(URI, Map)
and FileSystemProvider.newFileSystem(Path, Map)
.T
- The property type.env
- The map to retrieve the property from.property
- The name of the property.cls
- The class the property should be an instance of.IllegalArgumentException
- If the property is not present in the given map, or if its value has an incompatible type.public static <T> T getValue(Map<String,?> env, String property, Class<T> cls, T defaultValue)
FileSystemProvider.newFileSystem(URI, Map)
and FileSystemProvider.newFileSystem(Path, Map)
.T
- The property type.env
- The map to retrieve the property from.property
- The name of the property.cls
- The class the property should be an instance of.defaultValue
- The value that should be used if the property is not in the given map.IllegalArgumentException
- If the property's value has an incompatible type.Copyright © 2016–2023. All rights reserved.