public NetworkVehicleInterface(Context context, String uriString) throws DataSourceException { this(context, UriBasedVehicleInterfaceMixin.createUri( massageUri(uriString))); }
/** * Return true if the address and port are valid. * * @return true if the address and port are valid. */ public static boolean validateResource(String uriString) { try { URI uri = UriBasedVehicleInterfaceMixin.createUri(massageUri(uriString)); return UriBasedVehicleInterfaceMixin.validateResource(uri) && uri.getPort() < 65536; } catch(DataSourceException e) { return false; } }
@Override public boolean setResource(String otherResource) throws DataSourceException { if(!UriBasedVehicleInterfaceMixin.sameResource(mUri, massageUri(otherResource))) { setUri(otherResource); try { if(mSocket != null) { mSocket.close(); } } catch(IOException e) { } return true; } return false; }
private void setUri(String uri) throws DataSourceException { setUri(UriBasedVehicleInterfaceMixin.createUri(massageUri(uri))); }