byte[] () { try { Document document = ReadAction.compute(() -> FileDocumentManager.getInstance().getDocument(myFile)); if (document != null) { return document.getText().getBytes(myFile.getCharset()); } else { return myFile.contentsToByteArray(); } } catch (final IOException e) { LOG.warn(e); return null; } }