How to convert Byte array to ByteArrayOutputStream

54,532
byte[] bytes = ....;
ByteArrayOutputStream baos = new ByteArrayOutputStream(bytes.length);
baos.write(bytes, 0, bytes.length);

Method description:

Writes len bytes from the specified byte array starting at offset off to this byte array output stream.

Share:
54,532
Arun
Author by

Arun

I am a Sr.Consultant at CGI currently working in Pittsburgh. I am a full stack developer for 7 years specializing in following areas: Java/J2EE Microservices, MVC, Distributed Systems Javascript, Angular JS, Angular2, Typescript, jQuery Spring (cloud, integration, boot, security, jpa, portlet) AWS, Docker MongoDB, Oracle, SQL Server, MySql, Redis, DB2 Git, Atlassian tools, Jenkins Liferay portlet Websphere, MQ, Apache, Jboss Agile, Waterfall TDD, BDD practitioner Right now learning RX Java Unreal Engine game development

Updated on July 09, 2022

Comments

  • Arun
    Arun almost 2 years

    I need to convert a byte array to ByteArrayOutputStream so that I can display it on screen.