接続中の全てのクライアントにメッセージを送信する(現在接続中の全てのセッションを取得;session.getOpenSessions())
public void broadcast(String message, Session session) throws IOException {
session.getOpenSessions().forEach(s -> {
s.getAsyncRemote().sendText(message);
});
}
mySqlblobクラス には次の関数があります。; blob.getBytes//(assuming you have a ResultSet named RS) Blob blob = rs.getBlob("SomeDatabaseField"); int blobLength = (int) blob.length(); byte[] blobAsBytes = blob.getBytes(1, blobLength); //release the blob and free up memory. (since JDBC 4.0) blob.free();
public static void imageIoWrite() {
BufferedImage bImage = null;
try {
File initialImage = new File("C://Users/Rou/Desktop/image.jpg");
bImage = ImageIO.read(initialImage);
ImageIO.write(bImage, "gif", new File("C://Users/Rou/Desktop/image.gif"));
ImageIO.write(bImage, "jpg", new File("C://Users/Rou/Desktop/image.png"));
ImageIO.write(bImage, "bmp", new File("C://Users/Rou/Desktop/image.bmp"));
} catch (IOException e) {
System.out.println("Exception occured :" + e.getMessage());
}
System.out.println("Images were written succesfully.");
}

