Current Base64Data implmentation here : https://github.com/eclipse-ee4j/jaxb-ri/blob/b7d1ff7a13cecfaadde733387216b5cad09cc5b5/jaxb-ri/runtime/impl/src/main/java/org/glassfish/jaxb/runtime/v2/runtime/unmarshaller/Base64Data.java#L297 handles base64 encoding inefficiently by loading the whole content in memory before encoding it to base64.