Customer Portal

CustomJavaWriter - How to write file from byte

Comments 2

  • Avatar
    tomapi
    0
    Comment actions Permalink
    Found the solution - it's simple - byte field type has to be mapped to byte array as:
    Object objLogo = record.getField("logo").getValue();
    byte[] logo = (byte[]) objLogo;
    try (OutputStream os = getOutputStream(fileUrl, false)) {
    os.write(logo);
    }
    catch (IOException e) {
    throw new JetelRuntimeException(e);
    }
  • Avatar
    admin
    0
    Comment actions Permalink
    Hi Thomas,

    I am glad to see that you have successfully achieved your goal using the CustomJavaComponent. Thanks for posting the solution.

    However, I am a little bit concerned about the UniversalDataWriter difficulties as well. Would you be so kind and tell me what exactly have you experienced? As a matter of fact, the UniversalDataWriter should be able to write the byte field type to file as well. I have created a simple graph for your review (in attachment, use any picture as input data). Please review especially the metadata setup:

    metadataByte.jpg

    Please let me know what is your use case and what issue exactly you have encountered as I can provide more details. Thank you, Eva

Please sign in to leave a comment.