Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我需要知道如何在 java 中从加载的图像中获取字节数组。BufferedImage 似乎没有提供任何产生字节数组的方法,那么我应该使用什么呢?
BufferedImage bufferedImage; //assumed that you have created it already ByteArrayOutputStream byteStream = new ByteArrayOutputStream(); ImageIO.write(bufferedImage,"jpg", byteStream); byte[] byteArray = byteStream.toByteArray();