1

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 Answers1

1

Once you have the String representation of the clipboard, you can get the bytes via String#getBytes().

byte[] clipboardBytes = clipboardString.getBytes();
FThompson
  • 28,352
  • 13
  • 60
  • 93