Solved
Create a text file under /content/dam/abc called dam.txt, Usually the txt file gets downloaded on author instance, Think of a way to display its content on the browser instead of download.
Can any one please provide inputs on the same?
Can any one please provide inputs on the same?
@jhansi_123 I believe you have created custom component to render txt content - In that case please follow below steps.
Please refer below sample code which you may need to read txt from JCR.
File should have an nt:file node, which has a jcr:content node with jcr:data property.
You can read the xml from jcr:data i.e: jcrContent.getProperty("jcr:data").getBinary().getStream();/
InputStream is = jcrContent.getProperty("jcr:data").getBinary()
.getStream();
BufferedInputStream bis = new BufferedInputStream(is);
ByteArrayOutputStream buf = new ByteArrayOutputStream();
int resultNumber = bis.read();
while (resultNumber != -1) {
byte b = (byte) resultNumber;
buf.write(b);
resultNumber = bis.read();
}Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.