MJPEGストリームから画像(jpeg)をキャプチャしようとしています。
このチュートリアルhttp://www.walking-productions.com/notslop/2010/04/20/motion-jpeg-in-flash-and-java/
によると、 Content-Length: から始まり、で終わる日付を保存するだけです–私の境界。
しかし、何らかの理由で、保存したファイルを開くと、「ファイルが破損しているか、破損しているか、大きすぎるため、この画像を開けません」というメッセージが表示されます。
public class MJPEGParser{
    public static void main(String[] args){
        new MJPEGParser("http://192.168.0.100/video4.mjpg");
    }
    public MJPEGParser(String mjpeg_url){
        try{
            URL url = new URL(mjpeg_url);
            BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));
            String line;
            while((line = in.readLine()) != null){
                System.out.println(line);
                if(line.contains("Content-Length:")){
                    BufferedWriter out = new BufferedWriter(new FileWriter("out.jpeg"));
                    String content = in.readLine();
                    while(!content.contains("--myboundary")){
                        out.write(content);
                        System.out.println(content);
                        content = in.readLine();
                    }
                    out.close();
                    in.close();
                    System.exit(0);
                }
            }
            in.close();
        }catch(Exception e){
            e.printStackTrace();
        }
      }
}
どんなヒントでも本当に感謝します。