Android アプリから Java アプリに画像を送信する必要があります。基本的に、送信するrfモジュールに送信する画像からのバイト配列が必要です。別のrfモジュールがバイト配列を受信して、画像を作成する必要があるJavaアプリに送信します。
Android コード:
FileInputStream fis = new FileInputStream(myFile);
byte[] b=new byte[(int)myFile.length()];
fis.read(b);server.send(b);
Java コード:
FileOutputStream fwrite = new FileOutputStream(new File("my_xml"),true);
fwrite.write(bb);//bb is a byte from rf using input stream as soon as a byte comes it is read to file. This is necessary for some other reasons
fwrite.flush();
fwrite.close();
完全なファイルを取得した後:
FileInputStream fir=new FileInputStream("my_xml");
final BufferedImage bufferedImage = ImageIO.read(fir);
ImageIO.write(bufferedImage, "bmp", new File("image.bmp"));
fir.close();
エラー javax.imageio.IIOException: Bogus Huffman table definition が発生しています テキスト ファイルが完全に送信されているため、rf は正常に動作しています。