Commit c548cf12 by Facundo Javier Gelatti

Extract method ImageFormat.getSupportedFormats()

1 parent ca2c4034
......@@ -13,6 +13,7 @@ import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.util.Map;
import java.util.Set;
import java.util.TreeMap;
/**
......@@ -191,7 +192,11 @@ public abstract class ImageFormat {
return true;
}
public static Map<String, Class<? extends ImageFormat>> getRegisteredImageExtensions() {
public static Set<String> getSupportedFormats() {
return getRegisteredImageExtensions().keySet();
}
private static Map<String, Class<? extends ImageFormat>> getRegisteredImageExtensions() {
return registeredImageExtensions;
}
......
......@@ -39,7 +39,7 @@ public class Cli {
String extension = FileUtils.getFileExtension(steganogramPath);
ImageFormat image = ImageFormat.newInstance(extension);
if (image == null) {
String supportedFormats = String.join(", ", ImageFormat.getRegisteredImageExtensions().keySet());
String supportedFormats = String.join(", ", ImageFormat.getSupportedFormats());
LOG.error("Error: Currently only these file types are supported: {}", supportedFormats);
return;
}
......@@ -74,7 +74,7 @@ public class Cli {
String extension = FileUtils.getFileExtension(steganogramPath);
ImageFormat image = ImageFormat.newInstance(extension);
if (image == null) {
String supportedFormats = String.join(", ", ImageFormat.getRegisteredImageExtensions().keySet());
String supportedFormats = String.join(", ", ImageFormat.getSupportedFormats());
LOG.error("Error: Currently only these file types are supported: {}", supportedFormats);
return;
}
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!