org.unitils.io.conversion.impl
Class PropertiesConversionStrategy
java.lang.Object
org.unitils.io.conversion.impl.PropertiesConversionStrategy
- All Implemented Interfaces:
- ConversionStrategy<Properties>
public class PropertiesConversionStrategy
- extends Object
- implements ConversionStrategy<Properties>
This conversion strategy will try to convert the input stream into a Properties. The default file extension for this
conversion strategy is properties. So when not overriding the default file when using the @FileContent the file should.
end with '.properties' .
- Since:
- 3.3
- Author:
- Jeroen Horemans, Tim Ducheyne, Thomas De Rycke
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
PropertiesConversionStrategy
public PropertiesConversionStrategy()
convertContent
public Properties convertContent(InputStream inputStream,
String encoding)
throws IOException
- Description copied from interface:
ConversionStrategy
- Converts the content of the given stream into the target type.
The stream will not be closed during this method.
- Specified by:
convertContent
in interface ConversionStrategy<Properties>
- Parameters:
inputStream
- The stream with the content, not nullencoding
- The encoding to use when reading the stream, not null
- Returns:
- The converted instance of the target type, not null
- Throws:
IOException
getDefaultFileExtension
public String getDefaultFileExtension()
- Specified by:
getDefaultFileExtension
in interface ConversionStrategy<Properties>
- Returns:
- The default extension to use when no extension is provided, not null
getTargetType
public Class<Properties> getTargetType()
- Specified by:
getTargetType
in interface ConversionStrategy<Properties>
- Returns:
- The target type for the conversion, not null
Copyright © 2011. All Rights Reserved.