當前位置: 首頁>>代碼示例>>Java>>正文


Java UnknownFormatConversionException類代碼示例

本文整理匯總了Java中java.util.UnknownFormatConversionException的典型用法代碼示例。如果您正苦於以下問題:Java UnknownFormatConversionException類的具體用法?Java UnknownFormatConversionException怎麽用?Java UnknownFormatConversionException使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


UnknownFormatConversionException類屬於java.util包,在下文中一共展示了UnknownFormatConversionException類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onProgressUpdate

import java.util.UnknownFormatConversionException; //導入依賴的package包/類
@Override
protected void onProgressUpdate(Integer... values) {

    try {
        //LogUtils.i(TAG, "progress:" + ((tmp + loaded) / Float.valueOf(totals) * 100) + "tmp:" + tmp + "  load=:" + loaded + "  total:" + totals);
        long c = System.currentTimeMillis();
        if (mNotify != null && c - time > 800) {
            time = c;
            if (!mNotify.hasDeleteContent())
                mNotify.setDelecte(buildCancelContent(mDownLoadTask.getContext().getApplicationContext(), mDownLoadTask.getId()));

            int mProgress = (int) ((tmp + loaded) / Float.valueOf(totals) * 100);
            mNotify.setContentText(String.format(mDownLoadTask.getDownLoadMsgConfig().getLoading(), mProgress + "%"));
            mNotify.setProgress(100, mProgress, false);
        }

    } catch (UnknownFormatConversionException e) {
        e.printStackTrace();
    }
    long current = System.currentTimeMillis();
    used = current - begin;


}
 
開發者ID:Justson,項目名稱:AgentWeb,代碼行數:25,代碼來源:DownLoader.java

示例2: conversion

import java.util.UnknownFormatConversionException; //導入依賴的package包/類
private char conversion(String s) {
    c = s.charAt(0);
    if (!dt) {
        if (!Conversion.isValid(c))
            throw new UnknownFormatConversionException(String.valueOf(c));
        if (Character.isUpperCase(c))
            f.add(Flags.UPPERCASE);
        c = Character.toLowerCase(c);
        if (Conversion.isText(c))
            index = -2;
    }
    if (s.length() == 2) {
        c2 = s.charAt(1);
    }
    return c;
}
 
開發者ID:unktomi,項目名稱:form-follows-function,代碼行數:17,代碼來源:F3Formatter.java

示例3: getStatistics

import java.util.UnknownFormatConversionException; //導入依賴的package包/類
public String getStatistics() {
    try {
        double returnedPct = (bytesRead > 0 ? (100.0 * bytesReturned / bytesRead) : 100.0);
        return String
            .format("Bytes read: %12d\n  returned: %12d ( %3.2f %% )", bytesRead, bytesReturned,
                returnedPct)
            + String.format("\nReads past the end: %3d", nbReadsPastEnd)
            + String.format("\nReads forcing re-fetching of an earlier block: %3d", nbGoingBack)
            // A near-hit is when we're already fetching the data the user is asking for,
            // but we're not done loading it in.
            + String
            .format("\nCache\n hits:      %12d\n near-hits: %12d\n misses:    %12d", nbHit,
                nbNearHit, nbMiss);
    } catch (UnknownFormatConversionException x) {
        // let's not crash the whole program, instead just return no info
        return "(error while formatting statistics)";
    }
}
 
開發者ID:broadinstitute,項目名稱:gatk,代碼行數:19,代碼來源:SeekableByteChannelPrefetcher.java

示例4: checkText

import java.util.UnknownFormatConversionException; //導入依賴的package包/類
private void checkText() {
	if (precision != -1)
		throw new IllegalFormatPrecisionException(precision);
	switch (c) {
	case Conversion.PERCENT_SIGN:
		if (f.valueOf() != Flags.LEFT_JUSTIFY.valueOf()
				&& f.valueOf() != Flags.NONE.valueOf())
			throw new IllegalFormatFlagsException(f.toString());
		// '-' requires a width
		if (width == -1 && f.contains(Flags.LEFT_JUSTIFY))
			throw new MissingFormatWidthException(toString());
		break;
	case Conversion.LINE_SEPARATOR:
		if (width != -1)
			throw new IllegalFormatWidthException(width);
		if (f.valueOf() != Flags.NONE.valueOf())
			throw new IllegalFormatFlagsException(f.toString());
		break;
	default:
           throw new UnknownFormatConversionException(String.valueOf(c));
	}
}
 
開發者ID:bazelbuild,項目名稱:bazel,代碼行數:23,代碼來源:FormatSpecifier.java

示例5: test06

import java.util.UnknownFormatConversionException; //導入依賴的package包/類
@Test(timeout = 4000)
public void test06() throws Throwable {
    CoreDbConfiguration coreDbConfiguration0 = new CoreDbConfiguration();
    CoreDbConfiguration.JDBC_URL = "%jj;97ATvw)UDwSM|";
    // Undeclared exception!
    try {
        coreDbConfiguration0.getCoreJdbcURL();
        fail("Expecting exception: UnknownFormatConversionException");

    } catch (UnknownFormatConversionException e) {
        //
        // Conversion = 'j'
        //
        assertThrownBy("java.util.Formatter$FormatSpecifier", e);
    }
}
 
開發者ID:ChiralBehaviors,項目名稱:Ultrastructure,代碼行數:17,代碼來源:CoreDbConfiguration_ESTest.java

示例6: test09

import java.util.UnknownFormatConversionException; //導入依賴的package包/類
@Test(timeout = 4000)
public void test09() throws Throwable {
    CoreDbConfiguration coreDbConfiguration0 = new CoreDbConfiguration();
    coreDbConfiguration0.corePassword = "jdbc:postgresql://null:183/core";
    CoreDbConfiguration.JDBC_URL = "";
    CoreDbConfiguration.JDBC_URL = "3B=3WSv`LLpD)\"E<%";
    // Undeclared exception!
    try {
        coreDbConfiguration0.getCoreConnection();
        fail("Expecting exception: UnknownFormatConversionException");

    } catch (UnknownFormatConversionException e) {
        //
        // Conversion = '%'
        //
        assertThrownBy("java.util.Formatter", e);
    }
}
 
開發者ID:ChiralBehaviors,項目名稱:Ultrastructure,代碼行數:19,代碼來源:CoreDbConfiguration_ESTest.java

示例7: failsForInvalidPattern

import java.util.UnknownFormatConversionException; //導入依賴的package包/類
@Test(expected = UnknownFormatConversionException.class)
public void failsForInvalidPattern() throws IOException {
    new FormattedText(
        new TextOf("%%. Formatted %$"),
        new ListOf<>(1, "invalid")
    ).asString();
}
 
開發者ID:yegor256,項目名稱:cactoos,代碼行數:8,代碼來源:FormattedTextTest.java

示例8: doInBackground

import java.util.UnknownFormatConversionException; //導入依賴的package包/類
@Override
protected String doInBackground(InputStream... params) {

	try {
		parseELF(callback, params[0]);
	} catch (UnknownFormatConversionException | IOException e) {
		e.printStackTrace();
		return "failed";
	}
	return getString(R.string.success);
}
 
開發者ID:seaase,項目名稱:Elf-Editor,代碼行數:12,代碼來源:MainActivity.java

示例9: applyRule

import java.util.UnknownFormatConversionException; //導入依賴的package包/類
/**
 * Apply formatting rule corresponding to given identifier
 * @param identifier Symbolic identifier following '$'
 * @param arg Object argument
 * @return Formatted string
 * @throws IllegalFormatException Unable to format given object argument
 * according to specified rule
 */
public String applyRule(String identifier, Object arg) throws IllegalFormatException
{
    FormattingRule rule = formattingRules.get(identifier);
    if (rule == null)
    {
        throw new UnknownFormatConversionException("Formatting rule not available corresponding " +
            "to given identifier " + identifier);
    }

    return rule.apply(identifier, arg);
}
 
開發者ID:mochalog,項目名稱:mochalog,代碼行數:20,代碼來源:FormatSpec.java

示例10: fromString

import java.util.UnknownFormatConversionException; //導入依賴的package包/類
public Long fromString(String string) {
    if (string == null || string.isEmpty()) return null;

    Matcher matcher = ValueWithUnit.matcher(string.toLowerCase());
    if (!matcher.matches()) throw new UnknownFormatConversionException(String.format("Invalid format %s", string));

    Long value = Long.valueOf(matcher.group(1));
    String unit = matcher.group(2);
    if (unit.isEmpty()) return value;

    int index = units.toLowerCase().indexOf(unit.toLowerCase());
    return value * (long) Math.pow(getBase(), (double) index + 1);
}
 
開發者ID:edvin,項目名稱:tornadofx-controls,代碼行數:14,代碼來源:UnitConverter.java

示例11: getFormattedString

import java.util.UnknownFormatConversionException; //導入依賴的package包/類
public static String getFormattedString(Context context, @StringRes int resId, Object... formatArgs) {
    String result;
    final Resources resources = context.getResources();
    try {
        result = resources.getString(resId, formatArgs);
    }catch (UnknownFormatConversionException ex){
        final String resourceEntryName = resources.getResourceEntryName(resId);
        final String displayLanguage = Locale.getDefault().getDisplayLanguage();
        Logger.e("UnknownFormatConversion", "String: " + resourceEntryName + " Locale: " + displayLanguage);
        Crashlytics.log(3, "UnknownFormatConversion", "String: " + resourceEntryName + " Locale: " + displayLanguage);
        result = resources.getString(resId);
    }
    return result;
}
 
開發者ID:Aptoide,項目名稱:aptoide-client,代碼行數:15,代碼來源:AptoideUtils.java

示例12: getFormattedString

import java.util.UnknownFormatConversionException; //導入依賴的package包/類
public static String getFormattedString(@StringRes int resId, Resources resources,
    Object... formatArgs) {
  String result;
  try {
    result = resources.getString(resId, formatArgs);
  } catch (UnknownFormatConversionException ex) {
    final String resourceEntryName = resources.getResourceEntryName(resId);
    final String displayLanguage = Locale.getDefault()
        .getDisplayLanguage();
    Logger.e("UnknownFormatConversion",
        "String: " + resourceEntryName + " Locale: " + displayLanguage);
    result = ResourseU.getString(resId, resources);
  }
  return result;
}
 
開發者ID:Aptoide,項目名稱:aptoide-client-v8,代碼行數:16,代碼來源:AptoideUtils.java

示例13: processFile

import java.util.UnknownFormatConversionException; //導入依賴的package包/類
@Override
public void processFile(String filePath, String media) {
    mFabMenu.onBackPressed();
    mUploadProgress.setVisibility(View.VISIBLE);
    File file = new File(Util.getPath(getApplicationContext(), filePath));
    if (file.exists()) {
        Observable.create(new Observable.OnSubscribe<String[]>() {
            @Override
            public void call(Subscriber<? super String[]> subscriber) {
                String str = Util.decodeFile(file);
                if (str != null) {
                    int chunkSize = 4 * 8 * 1024;
                    subscriber.onNext(Util.splitStringBySize(str, chunkSize).toArray(new String[0]));
                    subscriber.onCompleted();
                } else {
                    subscriber.onError(new UnknownFormatConversionException("failed to convert " + filePath + " to string"));
                }
            }
        })
                .subscribeOn(Schedulers.computation())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(new Subscriber<String[]>() {
                    @Override
                    public void onCompleted() {

                    }

                    @Override
                    public void onError(Throwable e) {
                        mUploadProgress.setVisibility(View.GONE);
                    }

                    @Override
                    public void onNext(String[] strings) {
                        uploadFile(file.getName(), media, file.length(), strings);
                    }
                });
    }
}
 
開發者ID:lukamarin,項目名稱:Rocket.Chat-android,代碼行數:40,代碼來源:ChatActivity.java

示例14: getExpiry

import java.util.UnknownFormatConversionException; //導入依賴的package包/類
/**
 * Get the time at which the leased subscription will expire, or has expired.
 * 
 * @return The expiry date
 */
public Date getExpiry()
{
	String dateTime = getFieldValue(SubscribeOptionFields.expire);
	try
	{
		return XmppDateTime.parseDate(dateTime);
	}
	catch (ParseException e)
	{
		UnknownFormatConversionException exc = new UnknownFormatConversionException(dateTime);
		exc.initCause(e);
		throw exc;
	}
}
 
開發者ID:TTalkIM,項目名稱:Smack,代碼行數:20,代碼來源:SubscribeForm.java

示例15: determineAddressFieldsToDisplay

import java.util.UnknownFormatConversionException; //導入依賴的package包/類
public static char[] determineAddressFieldsToDisplay(String paramString)
  throws UnknownFormatConversionException
{
  if (TextUtils.isEmpty(paramString)) {
    throw new UnknownFormatConversionException("Cannot convert null/empty formats");
  }
  ArrayList localArrayList1 = new ArrayList();
  Iterator localIterator1 = getFormatSubStrings(paramString).iterator();
  while (localIterator1.hasNext())
  {
    String str = (String)localIterator1.next();
    if ((str.matches("%.")) && (!str.equals("%n"))) {
      localArrayList1.add(Character.valueOf(str.charAt(1)));
    }
  }
  ArrayList localArrayList2 = new ArrayList();
  Iterator localIterator2 = localArrayList1.iterator();
  while (localIterator2.hasNext())
  {
    char c = ((Character)localIterator2.next()).charValue();
    if (c == 'A')
    {
      localArrayList2.add(Character.valueOf('1'));
      localArrayList2.add(Character.valueOf('2'));
      localArrayList2.add(Character.valueOf('3'));
    }
    else
    {
      localArrayList2.add(Character.valueOf(c));
    }
  }
  char[] arrayOfChar = new char[localArrayList2.size()];
  for (int i = 0; i < arrayOfChar.length; i++) {
    arrayOfChar[i] = ((Character)localArrayList2.get(i)).charValue();
  }
  return arrayOfChar;
}
 
開發者ID:ChiangC,項目名稱:FMTech,代碼行數:38,代碼來源:AddressUtils.java


注:本文中的java.util.UnknownFormatConversionException類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。