I have this code that gets GPS data from input stream make the test file but there is nothing inside. Can you please tell me what is the problem in here?
public void run ()
{
byte[] buffer = new byte[1024];
int len = -1;
try
{
while ( ( len = this.in.read(buffer)) > -1 )
{
String gpsInfo = new String(buffer,0,len);
PrintWriter data = new PrintWriter("test.txt");
data.println(gpsInfo);
System.out.print(gpsInfo);
}
}
catch ( IOException e )
{
e.printStackTrace();
}
}
I am getting the right console output.