for (int i = 0; i < videoLenght; i++) {
for(int j=0;j<3;j++){
ByteArrayOutputStream baos = new ByteArrayOutputStream();
try {
ImageIO.write(ImageIO.read(new File("home/Adriano/workspace/LiveMonitor_update_1.2/image"+(i+j)+".jpg")), "jpg", baos);
baos.flush();
} catch (IOException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
int contentLength = baos.size();
String contentString = Integer.toString(contentLength);
while (contentString.length() < 10) {
contentString = " " + contentString;
}
try {
out[j].write(contentString.getBytes());
out[j].flush();
} catch (IOException e) {
e.printStackTrace();
}
try {
out[j].write(baos.toByteArray());
out[j].flush();
} catch (IOException e) {
e.printStackTrace();
}
}