import net.pterodactylus.sonitus.data.Format;
import com.google.common.base.Optional;
+import com.google.common.io.ByteStreams;
/**
* Wrapper around an {@link InputStream} that identifies the {@link Format} of
return Optional.of(new IdentifyingInputStream(rememberingInputStream.remembered(), format.get()));
}
+ /* try MP3 now. */
+ rememberingInputStream = new RememberingInputStream(rememberingInputStream.remembered());
+ InputStream limitedInputStream = ByteStreams.limit(rememberingInputStream, 1048576);
+ format = Mp3Identifier.identify(limitedInputStream);
+ if (format.isPresent()) {
+ return Optional.of(new IdentifyingInputStream(rememberingInputStream.remembered(), format.get()));
+ }
+
return Optional.absent();
}