4 import static yukihane.inqubus.InqubusConstants.*;
6 import java.util.regex.Matcher;
9 * nicobrowser.util.Utilより, 必要なものをピックアップしたクラス.
13 public final class Util {
19 * Content-Type から拡張子を決定する.
20 * @param contentType Content-Type文字列.
23 public static String getExtention(String contentType) {
24 if ("video/flv".equals(contentType) || "video/x-flv".equals(contentType)) {
26 } else if ("video/mp4".equals(contentType)) {
28 } else if ("application/x-shockwave-flash".equals(contentType)) {
31 return contentType.split("/")[1];
34 public static String getVideoId(final String alterId) {
35 final int startIdIdx = alterId.lastIndexOf("/") + 1;
36 final String altId = alterId.substring(startIdIdx);
37 final Matcher idMatcher = PATTERN_VIDEO_ID.matcher(altId);
38 if (!idMatcher.find()) {
39 throw new IllegalArgumentException("URL/IDの指定が不正です: " + alterId);
42 return idMatcher.group(1);