Code example for BufferedOutputStream

Methods: flushclosewrite

0
	        public void run(){ 
	        	try { 
	  	          // open a socket connection 
	  	          socket = new Socket(ipData, Integer.parseInt(portData));
	  	          // open I/O streams for objects 
	  	          bos = new BufferedOutputStream(socket.getOutputStream());
	  	          shortMessage=customConversion(shortMessage);
	  	          bos.write(shortMessage.getBytes());
	  	          bos.flush();
	  	          bos.close();
	  	          socket.close();
	  	          Log.e("SENT","Message \""+shortMessage+
	  	        		  "\" sent to \""+ipData+
	  	        		  " : "+portData+"\"");
	  	        }  
	  	        catch(Exception e) {
	  	          Log.e("C-ERROR",e.getMessage());
	  	        } 
	        } 
        }; 
Experience pair programming with AI  Get Codota for Java