IoT DAS Frameworks - Solar Plant Monitoring and Analytics/IOT_Gateway/Fronius_Protocol_Handler_Framework/FroniusConnector/src/serialportapp/SerialConnection.java
public void closeConnection() {
        // If port is alread closed just return.
        if (!open) {
            return;
        }

        // Check to make sure sPort has reference to avoid a NPE.
        if (sPort != null) {
            try {
                // close the i/o streams.
                os.close();
                is.close();
            } catch (IOException e) {
                System.err.println(e);
            }

            // Close the port.
            sPort.close();

        }

        open = false;
    }
/**
     * Close the port and clean up associated elements.
     */
Close the port and clean up associated elements.
Close the port and clean up associated elements .
public void closeConnection() {
        if (!open) {
            return;
        }
        if (sPort != null) {
            try {
                os.close();
                is.close();
            } catch (IOException e) {
                System.err.println(e);
            }
            sPort.close();
        }
        open = false;
    }
public void closeConnection ( ) { if ( ! open ) { return ; } if ( sPort != null ) { try { os . close ( ) ; is . close ( ) ; } catch ( IOException e ) { System . err . println ( e ) ; } sPort . close ( ) ; } open = false ; }
Close the port and clean up associated elements.
Close the port and clean up associated elements .
// If port is alread closed just return. // Check to make sure sPort has reference to avoid a NPE. // close the i/o streams. // Close the port.