public ByteBuffer unmarshall(Node in) throws Exception { return XpathUtils.asByteBuffer(".", in); }
/** * Evaluates the specified xpath expression, base64 decodes the data and * returns the result as a ByteBuffer. * <p> * This method can be expensive as a new xpath is instantiated per * invocation. Consider passing in the xpath explicitly via { * {@link #asDouble(String, Node, XPath)} instead. Note {@link XPath} is * not thread-safe and not reentrant. * * @param expression * The Xpath expression to evaluate. * @param node * The node on which to evaluate the expression. * * @return A ByteBuffer of base64 decoded data from the result of evaluating * the specified Xpath expression. * * @throws XPathExpressionException * If there are any problems evaluating the Xpath expression. */ public static ByteBuffer asByteBuffer(String expression, Node node) throws XPathExpressionException { return asByteBuffer(expression, node, xpath()); }
public ByteBuffer unmarshall(Node in) throws Exception { return XpathUtils.asByteBuffer(".", in); }
/** * Evaluates the specified xpath expression, base64 decodes the data and * returns the result as a ByteBuffer. * <p> * This method can be expensive as a new xpath is instantiated per * invocation. Consider passing in the xpath explicitly via { * {@link #asDouble(String, Node, XPath)} instead. Note {@link XPath} is * not thread-safe and not reentrant. * * @param expression * The Xpath expression to evaluate. * @param node * The node on which to evaluate the expression. * * @return A ByteBuffer of base64 decoded data from the result of evaluating * the specified Xpath expression. * * @throws XPathExpressionException * If there are any problems evaluating the Xpath expression. */ public static ByteBuffer asByteBuffer(String expression, Node node) throws XPathExpressionException { return asByteBuffer(expression, node, xpath()); }
/** * Tests that {@link XpathUtils#asByteBuffer(String, Node)} correctly base64 * decodes the XML text data and transforms it into a ByteBuffer. */ @Test public void testAsByteBuffer() throws Exception { String expectedData = "hello world"; Document document = XpathUtils.documentFrom(DOCUMENT); ByteBuffer byteBuffer = XpathUtils.asByteBuffer("Foo/Blob", document); assertEquals(expectedData.length(), byteBuffer.limit()); String data = new String(byteBuffer.array(), StringUtils.UTF8); assertEquals(expectedData, data); assertEquals(null, XpathUtils.asByteBuffer("Foo/Empty", document)); }
public ByteBuffer unmarshall(Node in) throws Exception { return XpathUtils.asByteBuffer(".", in); }
/** * Evaluates the specified xpath expression, base64 decodes the data and * returns the result as a ByteBuffer. * <p> * This method can be expensive as a new xpath is instantiated per * invocation. Consider passing in the xpath explicitly via { * {@link #asDouble(String, Node, XPath)} instead. Note {@link XPath} is * not thread-safe and not reentrant. * * @param expression * The Xpath expression to evaluate. * @param node * The node on which to evaluate the expression. * * @return A ByteBuffer of base64 decoded data from the result of evaluating * the specified Xpath expression. * * @throws XPathExpressionException * If there are any problems evaluating the Xpath expression. */ public static ByteBuffer asByteBuffer(String expression, Node node) throws XPathExpressionException { return asByteBuffer(expression, node, xpath()); }