code: private static String getResourceNameFromUri(final URI resourceAddress, final boolean usePathStyleUris,
              final String error) {
          Utility.assertNotNull("resourceAddress", resourceAddress);
  
          final String[] pathSegments = resourceAddress.getRawPath().split("/");
  
          final int expectedPartsLength = usePathStyleUris ? 3 : 2;
  
          if (pathSegments.length < expectedPartsLength) {
              throw new IllegalArgumentException(error);
          }
  
          final String resourceName = usePathStyleUris ? pathSegments[2] : pathSegments[1];
  
          return Utility.trimEnd(resourceName, '/');
      }
docs: Get the container, queue or table name from address from the URI.
  
  @param resourceAddress
  The queue Uri.
  @param usePathStyleUris
  a value indicating if the address is a path style uri.
  @return container name from address from the URI.
  @throws IllegalArgumentException