InputStream () { if (myDelegate != null) { return myDelegate; } int maxLength = Registry.intValue("editor.richcopy.max.size.megabytes") * FileUtilRt.MEGABYTE; final StringBuilder buffer = new StringBuilder(); try { build(buffer, maxLength); } catch (Exception e) { LOG.error(e); } String s = buffer.toString(); if (LOG.isDebugEnabled()) { LOG.debug("Resulting text: \n" + s); } try { myDelegate = new ByteArrayInputStream(s.getBytes(getCharset())); } catch (UnsupportedEncodingException e) { throw new RuntimeException(e); } return myDelegate; }