Why is PrintWriter used in this code snippet for bluetooth SPP communication?

158 Views Asked by At

Here is the code snippet:

StreamConnection st_connect=(StreamConnection)Connector.open(connectionURL);
OutputStream outStream=st_connect.openOutputStream();
PrintWriter pWriter=new PrintWriter(new OutputStreamWriter(outStream));
pWriter.write("Test\r\n");

From what I know OutputStream is used with PrintStream. If that is true, then why is a PrintWriter reference used in this case? For your reference, this is a part of a Bluetooth Client Application based on SPP .

0

There are 0 best solutions below