@Test public void testDetermineSchemeName() { assertEquals( "sms", ConnectorServiceImpl.determineSchemeName( "sms: assertEquals( "datagram", ConnectorServiceImpl.determineSchemeName( "datagram: assertEquals( "socket", ConnectorServiceImpl.determineSchemeName( "socket: assertEquals( "comm", ConnectorServiceImpl.determineSchemeName( "comm: assertEquals( "file", ConnectorServiceImpl.determineSchemeName( "file:C:/autoexec.bat" ) ); }
static final String determineSchemeName( final String aURI ) { String protocol = null; try { final URI uri = new URI( aURI ); protocol = uri.getScheme(); } catch ( final URISyntaxException exception ) { final int index = aURI.indexOf( ':' ); if ( index > 0 ) { protocol = aURI.substring( 0, index ); } } return protocol; }
ConnectorServiceImpl implements ConnectorService { static final String determineSchemeName( final String aURI ) { String protocol = null; try { final URI uri = new URI( aURI ); protocol = uri.getScheme(); } catch ( final URISyntaxException exception ) { final int index = aURI.indexOf( ':' ); if ( index > 0 ) { protocol = aURI.substring( 0, index ); } } return protocol; } }
ConnectorServiceImpl implements ConnectorService { static final String determineSchemeName( final String aURI ) { String protocol = null; try { final URI uri = new URI( aURI ); protocol = uri.getScheme(); } catch ( final URISyntaxException exception ) { final int index = aURI.indexOf( ':' ); if ( index > 0 ) { protocol = aURI.substring( 0, index ); } } return protocol; } ConnectorServiceImpl( final BundleContext aContext ); }
ConnectorServiceImpl implements ConnectorService { static final String determineSchemeName( final String aURI ) { String protocol = null; try { final URI uri = new URI( aURI ); protocol = uri.getScheme(); } catch ( final URISyntaxException exception ) { final int index = aURI.indexOf( ':' ); if ( index > 0 ) { protocol = aURI.substring( 0, index ); } } return protocol; } ConnectorServiceImpl( final BundleContext aContext ); @Override Connection open( final String aName ); @Override Connection open( final String aName, final int aMode ); @Override Connection open( final String aName, final int aMode, final boolean aTimeouts ); @Override DataInputStream openDataInputStream( final String aName ); @Override DataOutputStream openDataOutputStream( final String aName ); @Override InputStream openInputStream( final String aName ); @Override OutputStream openOutputStream( final String aName ); void shutdown(); }
ConnectorServiceImpl implements ConnectorService { static final String determineSchemeName( final String aURI ) { String protocol = null; try { final URI uri = new URI( aURI ); protocol = uri.getScheme(); } catch ( final URISyntaxException exception ) { final int index = aURI.indexOf( ':' ); if ( index > 0 ) { protocol = aURI.substring( 0, index ); } } return protocol; } ConnectorServiceImpl( final BundleContext aContext ); @Override Connection open( final String aName ); @Override Connection open( final String aName, final int aMode ); @Override Connection open( final String aName, final int aMode, final boolean aTimeouts ); @Override DataInputStream openDataInputStream( final String aName ); @Override DataOutputStream openDataOutputStream( final String aName ); @Override InputStream openInputStream( final String aName ); @Override OutputStream openOutputStream( final String aName ); void shutdown();  }