org.unitils.io.conversion.impl
Class StringConversionStrategy
java.lang.Object
org.unitils.io.conversion.impl.StringConversionStrategy
- All Implemented Interfaces:
- ConversionStrategy<String>
public class StringConversionStrategy
- extends Object
- implements ConversionStrategy<String>
This conversion strategy will try to convert the input stream into a String. The default file extension for this
conversion strategy is txt. So when not overriding the default file when using the @FileContent the file should
end with '.txt' .
- 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 |
StringConversionStrategy
public StringConversionStrategy()
convertContent
public String 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<String>
- 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<String>
- Returns:
- The default extension to use when no extension is provided, not null
getTargetType
public Class<String> getTargetType()
- Specified by:
getTargetType
in interface ConversionStrategy<String>
- Returns:
- The target type for the conversion, not null
Copyright © 2011. All Rights Reserved.