public static String getContentFromSeekableInput(SeekableInput in, boolean convertToHex) {
        String content = null;
        try {
            in.beginThreadAccess();

            long position = in.getAbsolutePosition();

            ByteArrayOutputStream out = new ByteArrayOutputStream();

            /*
            byte[] buf = new byte[1024];
            while( true ) {
                int read = in.read( buf, 0, buf.length );
                if( read < 0 )
                    break;
                out.write( buf, 0, read );
            }
            */

            while (true) {
                int read = in.getInputStream().read();
                if (read < 0)
                    break;
                out.write(read);
            }

            in.seekAbsolute(position);

            out.flush();
            out.close();
            byte[] data = out.toByteArray();
            if (convertToHex)
                content = Utils.convertByteArrayToHexString(data, true);
            else
                content = new String(data);
        }
        catch (IOException ioe) {
            logger.log(Level.FINE, "Problem getting debug string");
        }
        finally {
            in.endThreadAccess();
        }
        return content;
    }