Thursday, 1 September 2016

Java Tutorial : Java IO (ByteArrayOutputStream size method)


ByteArrayOutputStreamDemo.java
import java.io.ByteArrayOutputStream;
import java.io.IOException;

public class ByteArrayOutputStreamDemo
{

    public static void main(String[] args) throws IOException
    {
        ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();

        byteArrayOutputStream.write("Hello world".getBytes());
        System.out.println("byteArrayOutputStream = " + byteArrayOutputStream);

        /*
         * Returns the current size of the buffer.
         */

        System.out.println("size = " + byteArrayOutputStream.size());
        byteArrayOutputStream.close();
    }

}
Output
byteArrayOutputStream = Hello world
size = 11

Click the below link to download the code:
https://sites.google.com/site/ramj2eev1/home/javabasics/JavaIODemo_ByteArrayOS_size_method_App.zip?attredirects=0&d=1

Github Link:
https://github.com/ramram43210/Java/tree/master/BasicJava/JavaIODemo_ByteArrayOS_size_method_App

Bitbucket Link:
https://bitbucket.org/ramram43210/java/src/d261aab7f0b47dd247e532c02763fe1d7053f5d3/BasicJava/JavaIODemo_ByteArrayOS_size_method_App/?at=master

See also:
  • All JavaEE Viedos Playlist
  • All JavaEE Viedos
  • All JAVA EE Links
  • Servlets Tutorial
  • All Design Patterns Links
  • JDBC Tutorial
  • Java Collection Framework Tutorial
  • JAVA Tutorial
  • Kids Tutorial
  • No comments:

    Post a Comment

    Google+ Followers

    Google+ Badge