Example usage for org.apache.solr.common.util Base64 byteArrayToBase64

List of usage examples for org.apache.solr.common.util Base64 byteArrayToBase64

Introduction

In this page you can find the example usage for org.apache.solr.common.util Base64 byteArrayToBase64.

Prototype

public static String byteArrayToBase64(byte[] a, int offset, int len) 

Source Link

Usage

From source file:fi.vm.sade.organisaatio.resource.TempFileResource.java

License:EUPL

@GET
@Produces(MediaType.TEXT_PLAIN)/*from   w w w.ja  v  a  2 s.c o m*/
@Path("/{img}")
@Secured({ "ROLE_APP_ORGANISAATIOHALLINTA" })
public String getImage(@PathParam("img") String img) {
    LOG.info("getting " + getUser() + img);
    FileItem imgFile = data.get(getUser() + img);
    byte[] imgData = imgFile.get();
    return Base64.byteArrayToBase64(imgData, 0, imgData.length);
}

From source file:fi.vm.sade.organisaatio.service.converter.OrganisaatioToOrganisaatioRDTOConverter.java

License:EUPL

private String encodeToUUENCODED(BinaryData kuva) {
    if (kuva == null || kuva.getData() == null) {
        return null;
    }/* w  ww  . j av  a  2 s . co m*/

    return Base64.byteArrayToBase64(kuva.getData(), 0, kuva.getData().length);
}

From source file:net.semanticmetadata.lire.solr.BinaryDocValuesField.java

License:Open Source License

private String toBase64String(ByteBuffer buf) {
    return Base64.byteArrayToBase64(buf.array(), buf.position(), buf.limit() - buf.position());
}

From source file:org.socialhistoryservices.api.oai.Utils.java

License:Open Source License

public static ResumptionTokenType setResumptionToken(ResumptionToken oaiRequest, int cursor, int nextCursor,
        int matches) throws UnsupportedEncodingException {

    final ResumptionTokenType resumptionToken = new ResumptionTokenType();
    resumptionToken.setCursor(BigInteger.valueOf(cursor));
    final int resumptionTokenExpirationInSeconds = (Integer) getParam("resumptionTokenExpirationInSeconds");
    final long t = new Date().getTime() + 1000L * resumptionTokenExpirationInSeconds;
    resumptionToken.setExpirationDate(Utils.getGregorianDate(new Date(t)));
    resumptionToken.setCompleteListSize(BigInteger.valueOf(matches));

    // Parameters are in fixed order: "verb", "from", "until","set","metadataPrefix","cursor"
    final String s = (String) Utils.getParam("separator", ",");
    String token = oaiRequest.getVerb().value() + s + getValue(oaiRequest.getFrom()) + s
            + getValue(oaiRequest.getUntil()) + s + getValue(oaiRequest.getSet()) + s
            + getValue(oaiRequest.getMetadataPrefix()) + s + nextCursor;
    final byte[] bytes = token.getBytes("utf-8");
    resumptionToken.setValue(Base64.byteArrayToBase64(bytes, 0, bytes.length));
    return resumptionToken;
}