I\'m trying to send multiple images over a socket using java but I need a faster way to convert the images to a byte array so I can send them. I tried the following code but
BufferedImage img = ImageIO.read(new ByteArrayInputStream(bytes)); byte[] bytes = new byte[buf.capacity()]; buf.get(bytes, 0, bytes.length);