5 import javax.xml.parsers.*;
13 * 説明: ニコニコ動画の動画をコメントつきで保存
17 * 著作権: Copyright (c) 2007 PSI
27 public final class ConvertToVideoHook {
29 private ConvertToVideoHook() {
32 public static void convert(File file, File out, String ng_id, String ng_word) throws IOException {
34 final Packet packet = new Packet();
36 final SAXParserFactory spfactory = SAXParserFactory.newInstance();
38 final SAXParser parser = spfactory.newSAXParser();
39 // XMLファイルを指定されたデフォルトハンドラーで処理します
40 final NicoXMLReader nico_reader = new NicoXMLReader(packet, ng_id, ng_word);
42 parser.parse(file, nico_reader);
44 try (final FileOutputStream fos = new FileOutputStream(out)) {
47 } catch (IOException | SAXException | ParserConfigurationException ex) {
48 throw new IOException("コメント変換に失敗。ファイル名に使用できない文字が含まれているか正規表現の間違い?", ex);