问题
So I want to get the actual bytes of the user's clipboard. I can't find a way of doing this, all I find is how to get the clipboard as a String.
To get the clipboard as a String, I'd have to do something like this:
String data = (String) Toolkit.getDefaultToolkit().getSystemClipboard().getData(DataFlavor.stringFlavor);
Help will be appreciated.
回答1:
Once you have the String representation of the clipboard, you can get the bytes via String#getBytes().
byte[] clipboardBytes = clipboardString.getBytes();
来源:https://stackoverflow.com/questions/13094723/java-getting-bytes-of-clipboard