You should still pass Integer.MAX_VALUE here to getBytes(). This is needed to allow opening a note that is large, like 12 MiB worth of text. These shouldn't happen, but if they do we should still make a good effort at displaying it.

When the note is bigger than the default or the size passed here, we throw LargeObjectException. Maybe you want to trap it here and display a warning that the note is too big to display?

And you might as well use getCachedBytes() too to avoid copying.