我想将图像转换为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 ...? –