public String extractDeclaredEncoding(byte[] bytes) {
		int index = ArrayUtils.indexOf(bytes, (byte) '>');
		if (index == -1) {
			return null;
		}

		String pi = new String(ArrayUtils.subarray(bytes, 0, index + 1)).replace('\'', '"');
		index = StringUtils.indexOf(pi, "encoding=\"");
		if (index == -1) {
			return null;
		}
		String encoding = pi.substring(index + 10);
		encoding = encoding.substring(0, encoding.indexOf('"'));
		return encoding;
	}
@Test
	void testExtractDeclaredEncoding() {
		Assertions.assertNull(encodingDetector.extractDeclaredEncoding("<?xml ?>".getBytes()));
		Assertions.assertNull(encodingDetector.extractDeclaredEncoding("<feed></feed>".getBytes()));
		Assertions.assertEquals("UTF-8", encodingDetector.extractDeclaredEncoding("<?xml encoding=\"UTF-8\" ?>".getBytes()));
		Assertions.assertEquals("UTF-8", encodingDetector.extractDeclaredEncoding("<?xml encoding='UTF-8' ?>".getBytes()));
		Assertions.assertEquals("UTF-8", encodingDetector.extractDeclaredEncoding("<?xml encoding='UTF-8'?>".getBytes()));
	}