cancel
Showing results for 
Search instead for 
Did you mean: 

After uploading a html File - read to string

Former Member
0 Kudos

Hello experts 😉

I'm trying to parse a html file which was uploaded by the user via UploadUi. This works fine.

Now I have the file in a context node (type. Resource). I need all characters from the html file in a string to parse the string and to build a new html file for download.

I need some help to reading out the resource to a string.

kind regards

Michael

Accepted Solutions (1)

Accepted Solutions (1)

Qualiture
Active Contributor
0 Kudos

Hi Michael,

You can use something like this:

IWDResource resource        = wdContext.currentContextElement().getYourResource();
InputStream fileInputStream = resource.read(false);
int         size            = fileInputStream.available();
byte[]      byteArray       = new byte[size];

fileInputStream.read(byteArray, 0, size);

String yourHTML = new String(byteArray);


Former Member
0 Kudos

Hi Robin,

thank's .. this solved my problem in an easy way.

Answers (0)