{
//---------------------------------------------------
// get a list of formats currently on the clipboard
//---------------------------------------------------
XTransferable xTransferable = xClipboard.getContents();
DataFlavor[] aDflvArr = xTransferable.getTransferDataFlavors();
// print all available formats
System.out.println("Reading the clipboard...");
System.out.println("Available clipboard formats:");
DataFlavor aUniFlv = null;
for (int i=0;i<aDflvArr.length;i++)
{
System.out.println( "MimeType: " +
aDflvArr[i].MimeType +
" HumanPresentableName: " +
aDflvArr[i].HumanPresentableName );
// if there is the format unicode text on the clipboard save the
// corresponding DataFlavor so that we can later output the string
if ( aDflvArr[i].MimeType.equals("text/plain;charset=utf-16") )
{
aUniFlv = aDflvArr[i];
}
}
System.out.println("");
try
{
if (aUniFlv != null)
{
System.out.print("Unicode text on the clipboard ...\nYour selected text \"");
Object aData = xTransferable.getTransferData(aUniFlv);
System.out.println(AnyConverter.toString(aData)
+ "\" is now in the clipboard.\n");
}
}
catch( UnsupportedFlavorException ex )