Java tutorial
import java.io.ByteArrayOutputStream; import java.io.IOException; public class Main { public static void main(String[] args) throws IOException { ByteArrayOutputStream baos = new ByteArrayOutputStream(); baos.write(75); String str = baos.toString(); System.out.println("Before Resetting : " + str); baos.reset(); baos.write(65); str = baos.toString(); System.out.println("After Resetting : " + str); } }