You could wrap it in a Java NIO read only ByteBuffer, but for small data this might not safe much as it is an additional object instance and You need to keep the backing Array unmodified.
Greetings Bernd > Am 22.10.2013 um 06:49 schrieb Damjan Jovanovic <dam...@apache.org>: > > On Tue, Oct 22, 2013 at 3:02 AM, sebb <seb...@gmail.com> wrote: >>> + >>> + public byte[] getComment() { >>> + return comment; >> >> This is better, but the array can still be modified externally. >> >> Might make more sense to convert the array to a String and return that >> instead - Strings are immutable, but arrays are not. >> Otherwise perhaps return a copy. > > The text encoding for the JPEG COM segment is unspecified, and can be > anything in practice, including binary data instead of text, so we > have to return a byte[]. > > I am concerned about the performance implications of copying data > around so much, but guess it's not much data. > > --------------------------------------------------------------------- > To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org > For additional commands, e-mail: dev-h...@commons.apache.org > --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org For additional commands, e-mail: dev-h...@commons.apache.org