How do I convert an InputStream to a string in Java?
Learn how to load text in a binary file to an InputStream and convert it to a string using ByteArrayOutputStream with a ByteBuffer.
When reading text from a binary file or serialized transmission in Java, developers will often need to convert the stream to text. In this video, Brian Gorman begins with a quick overview of working with binary data using input and output streams. He then teaches you how to open a file into an InputStream and use ByteArrayOutputStream with a ByteBuffer to output the stream as a string. Novice Java developers will also learn how to use the StringBuilder object to build a string from their incoming data.
Access in-depth Java training with our Beginning Java Learning Path
Brian L. Gorman is an experienced .NET developer, certified as an MCSD in C# .NET. Holding a Masters of Science in computer information systems, he has many years of experience instructing college-level SQL database, C#, VB.NET, Java, and Microsoft Office courses. Brian has also authored a number of full technical video courses on these subjects.