@SuppressWarnings("unchecked")
public <T extends Spin<?>> T createSpinFromStream(InputStream parameter) {
ensureNotNull("parameter", parameter);
RewindableInputStream rewindableStream = new RewindableInputStream(parameter, READ_SIZE);
DataFormat<T> matchingDataFormat = null;
for (DataFormat<?> format : DataFormats.AVAILABLE_FORMATS) {
if (format.getReader().canRead(rewindableStream)) {
matchingDataFormat = (DataFormat<T>) format;
}
try {
rewindableStream.rewind();
} catch (IOException e) {
throw LOG.unableToReadInputStream(e);
}
}