org.unitils.io.conversion
Interface ConversionStrategy<T>

All Known Implementing Classes:
PropertiesConversionStrategy, StringConversionStrategy

public interface ConversionStrategy<T>

A conversion strategy converts the given input stream to the object specified (T). It will consider the given encoding when doing the conversion.

Since:
3.3
Author:
Jeroen Horemans, Tim Ducheyne, Thomas De Rycke

Method Summary
 T convertContent(InputStream inputStream, String encoding)
          Converts the content of the given stream into the target type.
 String getDefaultFileExtension()
           
 Class<T> getTargetType()
           
 

Method Detail

convertContent

T convertContent(InputStream inputStream,
                 String encoding)
                 throws IOException
Converts the content of the given stream into the target type. The stream will not be closed during this method.

Parameters:
inputStream - The stream with the content, not null
encoding - The encoding to use when reading the stream, not null
Returns:
The converted instance of the target type, not null
Throws:
IOException

getDefaultFileExtension

String getDefaultFileExtension()
Returns:
The default extension to use when no extension is provided, not null

getTargetType

Class<T> getTargetType()
Returns:
The target type for the conversion, not null


Copyright © 2011. All Rights Reserved.