io.github.amayaframework.swaggerui.SwaggerUI Maven / Gradle / Ivy
package io.github.amayaframework.swaggerui;
import io.github.amayaframework.openui.OpenUI;
import java.io.ByteArrayInputStream;
import java.io.InputStream;
import java.util.Set;
final class SwaggerUI implements OpenUI {
private static final Set PARTS = Set.of(
"favicon-16x16.png",
"favicon-32x32.png",
"index.css",
"index.html",
"oauth2-redirect.html",
"swagger-ui.css",
"swagger-ui-bundle.js",
"swagger-ui-standalone-preset.js"
);
private final byte[] indexBuffer;
SwaggerUI(byte[] indexBuffer) {
this.indexBuffer = indexBuffer;
}
@Override
public String getIndex() {
return Util.INDEX;
}
@Override
public Iterable getParts() {
return PARTS;
}
@Override
public InputStream getInputStream(String part) {
if (Util.INDEX.equals(part)) {
return new ByteArrayInputStream(indexBuffer);
}
if (!PARTS.contains(part)) {
return null;
}
return Util.getInputStream(part);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy