我想將圖像轉換爲byte[]
並通過servlet發送。 我已經將圖像轉換爲byte[]
,但發送給客戶?如何通過servlet發送字節[] java
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
String name=request.getParameter("name");
File f = new File("/Users/shilu/MyProject/Chat/Photo/" + name);
byte[] data = Files.readAllBytes(f.toPath());
//What to do now??
}
什麼樣的形象? PNG,JPG ...? –