I am implementing a mp3 player which is command line.
I want show the mp3 duration like this
Now Playing :: hello.mp3 Duration :: 1.20
But when I use System.out.println it shows
Now Playing :: hello.mp3 Duration :: 1.20
Now Playing :: hello.mp3 Duration :: 1.21
Now Playing :: hello.mp3 Duration :: 1.22
Now Playing :: hello.mp3 Duration :: 1.23
Now Playing :: hello.mp3 Duration :: 1.24
Now Playing :: hello.mp3 Duration :: 1.25
.....
Basically the duration getting update by a thread, I want to show it a single line, I mean the duration have to be updated in single line. I have see the Flushable interface
but didn't get it. Please help me out
here is my thread
while(p.getPlayer().isComplete() == false){
String bOutput = "\r Duration ::" + (int) ((p.getPlayer().getPosition() / (1000*60)) % 60) + " : " + (int) (p.getPlayer().getPosition() / 1000) % 60;
//p.getBufferedOutputStream().write(bOutput.getBytes());
//p.getBufferedOutputStream().flush();
System.out.println(bOutput);
Thread.sleep(1000);
}