public MessageValues extractHeaders(Message<byte[]> message, boolean copyRequestHeaders) throws Exception {
		byte[] bytes = message.getPayload();
		ByteBuffer byteBuffer = ByteBuffer.wrap(bytes);
		int headerCount = byteBuffer.get() & 0xff;
		if (headerCount < 255) {
			return oldExtractHeaders(byteBuffer, bytes, headerCount, message, copyRequestHeaders);
		}
		else {
			headerCount = byteBuffer.get() & 0xff;
			Map<String, Object> headers = new HashMap<String, Object>();
			for (int i = 0; i < headerCount; i++) {
				int len = byteBuffer.get() & 0xff;
				String headerName = new String(bytes, byteBuffer.position(), len, "UTF-8");
				byteBuffer.position(byteBuffer.position() + len);
				len = byteBuffer.getInt();
				String headerValue = new String(bytes, byteBuffer.position(), len, "UTF-8");
				Object headerContent = this.objectMapper.fromJson(headerValue, Object.class);
				headers.put(headerName, headerContent);
				byteBuffer.position(byteBuffer.position() + len);
			}
			byte[] newPayload = new byte[byteBuffer.remaining()];
			byteBuffer.get(newPayload);
			return buildMessageValues(message, newPayload, headers, copyRequestHeaders);
		}
	}
Return a message where headers, that were originally embedded into the payload, have been promoted
back to actual headers. The new payload is now the original payload.

@param message the message to extract headers
@param copyRequestHeaders boolean value to specify if original headers should be copied
spring-xd-messagebus-spi/src/main/java/org/springframework/xd/dirt/integration/bus/EmbeddedHeadersMessageConverter.java