Create a {@code Cursor} given its URL safe encoded form.
12680
public static Cursor fromUrlSafe(String urlSafe) {
    try {
      return Cursor.copyFrom(BaseEncoding.base64Url().decode(urlSafe));
    } catch (IllegalArgumentException e) {
      throw new IllegalStateException("Unexpected decoding exception", e);
    }
  }
320075
public static LineCaptcha createLineCaptcha(int width, int height, int codeCount, int lineCount) {
		return new LineCaptcha(width, height, codeCount, lineCount);
	}
179015
public static String urlEncode(String input) {
        try {
            return URLEncoder.encode(input, "UTF-8");
        } catch (UnsupportedEncodingException ex) {
            throw new AssertionError("UTF-8 not supported", ex);
        }
    }
1372131
private void handleRawText(TextCursor cursor, int limit, ArrayList<MDText> elements) {
        while (true) {
            BasicUrl url = findUrl(cursor, limit);
            if (url != null) {
                String link = cursor.text.substring(url.getStart(), url.getEnd());

                // Handling text before url first
                addText(cursor, url.getStart(), elements);

                // Adding url
                elements.add(new MDUrl(link, link));

                // Adjusting offset
                cursor.currentOffset = url.getEnd();

                continue;
            }

            addText(cursor, limit, elements);

            return;
        }
    }
290830
def save_cursor(self):
        """"""
        self.savepoints.append(Savepoint(copy.copy(self.cursor),
                                         self.g0_charset,
                                         self.g1_charset,
                                         self.charset,
                                         mo.DECOM in self.mode,
                                         mo.DECAWM in self.mode))
694484
private GeoResult<?> buildGeoResult(final ArangoCursor<?> cursor) {
		GeoResult<?> geoResult = null;
		while (cursor.hasNext() && geoResult == null) {
			final Object object = cursor.next();
			if (!(object instanceof VPackSlice)) {
				continue;
			}

			final VPackSlice slice = (VPackSlice) object;
			final VPackSlice distSlice = slice.get("_distance");
			final Double distanceInMeters = distSlice.isDouble() ? distSlice.getAsDouble() : null;
			if (distanceInMeters == null) {
				continue;
			}

			final Object entity = operations.getConverter().read(domainClass, slice);
			final Distance distance = new Distance(distanceInMeters / 1000, Metrics.KILOMETERS);
			geoResult = new GeoResult<>(entity, distance);
		}
		return geoResult;
	}
99394
public void setCursor(Object object, String cursor) {
		if (isAttached()) {
			helper.setCursor(object, cursor);
		}
	}
1081947
public Transliterator safeClone() {
        UnicodeFilter filter = getFilter();
        if (filter != null && filter instanceof UnicodeSet) {
            filter = new UnicodeSet((UnicodeSet)filter);
        }
        return new AnyTransliterator(getID(), filter, target, targetScript, widthFix, cache);
    }
1154239
public ServletModule.ServletKeyBindingBuilder serve(List<String> urlPatterns) {
    return new ServletKeyBindingBuilderImpl(parsePatterns(UriPatternType.SERVLET, urlPatterns));
  }
1351968
public static String urlEncode(String str) throws UnsupportedEncodingException {
    // Preserve original behavior that passing null for an object id will lead
    // to us actually making a request to /v1/foo/null
    if (str == null) {
      return null;
    } else {
      // Don't use strict form encoding by changing the square bracket control
      // characters back to their literals. This is fine by the server, and
      // makes these parameter strings easier to read.
      return URLEncoder.encode(str, CHARSET)
        .replaceAll("%5B", "[")
        .replaceAll("%5D", "]");
    }
  }
567889
public static void dumpCursor(Cursor cursor, StringBuilder sb) {
        sb.append(">>>>> Dumping cursor " + cursor + "\n");
        if (cursor != null) {
            int startPos = cursor.getPosition();

            cursor.moveToPosition(-1);
            while (cursor.moveToNext()) {
                dumpCurrentRow(cursor, sb);
            }
            cursor.moveToPosition(startPos);
        }
        sb.append("<<<<<\n");
    }
37409
@Override
    public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) {
        Cursor result = null;

        if (!controller.hasPreinitialized()) {
            throw new IllegalStateException("Controller has not been initialized.");
        }

        int patternCode = controller.getUriMatcher().match(uri);
        MatcherPattern pattern = controller.findMatcherPattern(patternCode);
        if (pattern == null) {
            throw new IllegalArgumentException("unknown uri : " + uri.toString());
        }

        Parameter parameter = new Parameter(uri, projection, selection, selectionArgs, sortOrder);
        SQLiteDatabase db = this.getHelper().getReadableDatabase();

        result = onQuery(this.getHelper(), db, pattern, parameter);
        if (result != null) {
            this.onQueryCompleted(result, uri, pattern, parameter);
        }
        return result;
    }
1333873
public final Cursor<T> queryByLikeExample (Connection conn, T obj,
                                               FieldMask mask)
    {
        return new Cursor<T>(this, conn, obj, mask, true);
    }
508564
public static String urlDecode(String content, Charset charset, TestContext context) {
        return new UrlDecodeFunction().execute(Arrays.asList(content, charset.displayName()), context);
    }
1091158
def cursor(self,*args,**kwargs):
        
        d_out("Handle.cursor: Creating cursor..")
        if not self.open:
            raise Exception("Connection isn't open.")

        if 'cursor_factory' not in kwargs or kwargs['cursor_factory'] == None:
            kwargs["cursor_factory"] = Cursor
        callback = kwargs.pop('callback', None)
        cur = self.conn.cursor(*args,**kwargs)
        if callback:
            d_out('Handle.cursor() setting callback attrib {0}'.format(callback))
            cur.callback = callback
        return cur
1253212
public static Intent newOpenWebBrowserIntent(String url) {
        if (!url.startsWith("https://") && !url.startsWith("http://")) {
            url = "http://" + url;
        }
        Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
        return intent;
    }
73047
def _cursor(self, *args, **kwargs):
        """"""
        # The args and kwargs are not part of the standard,
        # but some database modules seem to use these.
        transaction = self._transaction
        if not transaction:
            self._ping_check(2)
        try:
            if self._maxusage:
                if self._usage >= self._maxusage:
                    # the connection was used too often
                    raise self._failure
            cursor = self._con.cursor(*args, **kwargs)  # try to get a cursor
        except self._failures as error:  # error in getting cursor
            try:  # try to reopen the connection
                con = self._create()
            except Exception:
                pass
            else:
                try:  # and try one more time to get a cursor
                    cursor = con.cursor(*args, **kwargs)
                except Exception:
                    pass
                else:
                    self._close()
                    self._store(con)
                    if transaction:
                        raise error  # re-raise the original error again
                    return cursor
                try:
                    con.close()
                except Exception:
                    pass
            if transaction:
                self._transaction = False
            raise error  # re-raise the original error again
        return cursor