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


Java Charsets.UTF_8屬性代碼示例

本文整理匯總了Java中org.apache.commons.codec.Charsets.UTF_8屬性的典型用法代碼示例。如果您正苦於以下問題:Java Charsets.UTF_8屬性的具體用法?Java Charsets.UTF_8怎麽用?Java Charsets.UTF_8使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在org.apache.commons.codec.Charsets的用法示例。


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

示例1: PlayerSkin

public PlayerSkin(UUID uuid){
	profile = new GameProfile(uuid, ProfileUtil.getUsername(uuid));
	PropertyMap properties = ProfileUtil.getProperties(uuid);
	if(properties !=null){
		Property textureProperty = Iterables.getFirst(properties.get("textures"), null);
		Map<MinecraftProfileTexture.Type, MinecraftProfileTexture> map = null;
		MinecraftTexturesPayload result;
        try {
            String json = new String(Base64.decodeBase64(textureProperty.getValue()), Charsets.UTF_8);
            result = gson.fromJson(json, MinecraftTexturesPayload.class);
            map = result.getTextures();
        } catch (JsonParseException e) {
            ModLogger.error("Could not decode textures payload", e);
            map = new HashMap<MinecraftProfileTexture.Type, MinecraftProfileTexture>();
        }
        for(Type type : map.keySet()){
        	Minecraft.getMinecraft().getSkinManager().loadSkin(map.get(type), type, this);
        }
	}
	
	//playerTextures = downloadPlayerTextures(profile);
}
 
開發者ID:Alec-WAM,項目名稱:CrystalMod,代碼行數:22,代碼來源:DownloadedTextures.java

示例2: toParameter

private Object toParameter(Column col) {
	Object value;
	if (col instanceof StringColumn){
		// use UTF-8 to match open replicator default charset
		value = new String((byte[])col.getValue(), Charsets.UTF_8);
	} else {
		value = col.getValue();
	}
		
	if (!(value instanceof java.util.Date)) {
		return value;
	}
	if (value instanceof java.sql.Date || value instanceof java.sql.Timestamp) {
		return value;
	}
	// open replicator sometimes use java.util.Date instead of java.sql.Date. 
	value = new Timestamp(((java.util.Date)value).getTime());
	return value;
}
 
開發者ID:waterguo,項目名稱:antsdb,代碼行數:19,代碼來源:MysqlSlave.java

示例3: handleRequest

public void handleRequest(final RestRequest request, final RestChannel channel) {

		String inputStr = new String(request.content().toBytes(), Charsets.UTF_8);

		JSONObject input = null;
		if (!request.method().equals(GET)) {
			input = new JSONObject(inputStr);
		}

		System.out.println("Path:" + request.path());

		if (request.path().equals("/_river/report/now")) {
			ESReport esReport = new ESReport(client);
			esReport.process(inputStr);
			channel.sendResponse(new BytesRestResponse(OK, "{status:finished}"));
		}
	}
 
開發者ID:raghavendar-ts,項目名稱:Elasticsearch-Report-Plugin,代碼行數:17,代碼來源:ESReportPluginRestHandler.java

示例4: determineCacheId

private String determineCacheId(ValueSet vs, boolean heirarchical) throws Exception {
  // just the content logical definition is hashed
  ValueSet vsid = new ValueSet();
  vsid.setCompose(vs.getCompose());
  JsonParser parser = new JsonParser();
  parser.setOutputStyle(OutputStyle.NORMAL);
  ByteArrayOutputStream b = new  ByteArrayOutputStream();
  parser.compose(b, vsid);
  b.close();
  String s = new String(b.toByteArray(), Charsets.UTF_8);
  // any code systems we can find, we add these too. 
  for (ConceptSetComponent inc : vs.getCompose().getInclude()) {
    CodeSystem cs = fetchCodeSystem(inc.getSystem());
    if (cs != null) {
      String css = cacheValue(cs);
      s = s + css;
    }
  }
  s = s + "-"+Boolean.toString(heirarchical);
  String r = Integer.toString(s.hashCode());
  //    TextFile.stringToFile(s, Utilities.path(cache, r+".id.json"));
  return r;
}
 
開發者ID:jamesagnew,項目名稱:hapi-fhir,代碼行數:23,代碼來源:BaseWorkerContext.java

示例5: getMessage

public String getMessage() {
	int size = getSize();
	byte[] bytes = new byte[size];
	for (int i=0; i<size; i++) {
		bytes[i] = Unsafe.getByte(this.addr + OFFSET_MESSAGE + i);
	}
	return new String(bytes, Charsets.UTF_8);
}
 
開發者ID:waterguo,項目名稱:antsdb,代碼行數:8,代碼來源:Gobbler.java

示例6: getResultEncoder

/**
 * encoder to convert literal result to the client, equivalent to character_set_results 
 * @return
 */
public Charset getResultEncoder() {
    if (this.resultEncoder != null) {
        return this.resultEncoder;
    }
    return (this.parent != null) ? this.parent.getResultEncoder() : Charsets.UTF_8;
}
 
開發者ID:waterguo,項目名稱:antsdb,代碼行數:10,代碼來源:SystemParameters.java

示例7: getResourceRequestString

public static String getResourceRequestString(String path, String apiKey) throws IOException {
    File file = new File(path);

    if (!file.exists()) {
        //try set /core path
        path = "core/" + path;
        file = new File(path);
    }

    InputStream stream = getResourceRequestStream(path);

    byte[] b = new byte[(int) file.length()];
    int len = b.length;
    int total = 0;

    while (total < len) {
        int result = stream.read(b, total, len - total);
        if (result == -1) {
            break;
        }
        total += result;
    }
    String expected = new String(b, Charsets.UTF_8);
    if (apiKey != null && !apiKey.isEmpty()) {
        expected = expected.replace("\"AccessToken\":\"+DummyKEY\"",
                "\"AccessToken\":\"" + apiKey + "\"");
    }
    return expected;
}
 
開發者ID:Longri,項目名稱:cachebox3.0,代碼行數:29,代碼來源:TestUtils.java

示例8: hash

/**
 * Calculate the SHA-512 message digest hash of the
 * provided string and return it with its binary
 * data Base64 encoded.
 *
 * @param string The string to hash
 * @return the hashed string Base64 encoded.
 */
public static String hash(final String string) {
    try {
        final byte[] digest = MessageDigest.getInstance(ALGORITHM).digest((string + SALT).getBytes(Charsets.UTF_8));
        return new String(Base64.encodeBase64(digest),Charsets.UTF_8);
    } catch (final NoSuchAlgorithmException e) {
        throw new AlgorithmNotSupportedException(ALGORITHM, e);
    }
}
 
開發者ID:eSolutionsGrup,項目名稱:license-manager,代碼行數:16,代碼來源:Hasher.java

示例9: parse

@Override
public Supplier<Object> parse(AnnotatedType type, String urlPart) {
    Pair<Optional<String>, String> pair = SerializerHelper.parsePrefix(urlPart);
    String prefix = pair.getA().get();
    if ("null".equals(prefix))
        return null;

    @SuppressWarnings("rawtypes")
    Class<? extends EsEntity> cls = entityClassNumbers.inverse().get(Integer.parseInt(prefix));
    String id = new String(BaseEncoding.base64Url().decode(pair.getB()), Charsets.UTF_8);

    return () -> {
        return es.get(cls, id).orElseThrow(() -> new RuntimeException("Entity not found: " + cls + " id: " + id));
    };
}
 
開發者ID:ruediste,項目名稱:rise,代碼行數:15,代碼來源:EsEntityArgumentSerializer.java

示例10: loadResource

private static String loadResource(String recordingName) {
    try {
        URI recURI = WinRmClientRecordedTest.class.getClassLoader().getResource("recordings/" + recordingName + ".xml").toURI();
        return new String(Files.readAllBytes(Paths.get(recURI)), Charsets.UTF_8);
    } catch (IOException | URISyntaxException e) {
        throw new IllegalStateException("Couldn't load recording", e);
    }
}
 
開發者ID:cloudsoft,項目名稱:winrm4j,代碼行數:8,代碼來源:WinRmClientRecordedTest.java

示例11: handleRequest

public void handleRequest(final RestRequest request, final RestChannel channel) {

		String inputStr = new String(request.content().toBytes(), Charsets.UTF_8);

		if (request.path().equals("/_report")) {
			ESReport esReport = new ESReport(client);
			esReport.process(inputStr);
			channel.sendResponse(new BytesRestResponse(OK, "{status:finished}"));
		}
	}
 
開發者ID:Doolyk,項目名稱:Elasticsearch2Excel-plugin,代碼行數:10,代碼來源:ESReportPluginRestHandler.java

示例12: cacheValue

private String cacheValue(CodeSystem cs) throws IOException {
  CodeSystem csid = new CodeSystem();
  csid.setId(cs.getId());
  csid.setVersion(cs.getVersion());
  csid.setContent(cs.getContent());
  csid.setHierarchyMeaning(CodeSystemHierarchyMeaning.GROUPEDBY);
  for (ConceptDefinitionComponent cc : cs.getConcept()) 
    csid.getConcept().add(processCSConcept(cc));
  JsonParser parser = new JsonParser();
  parser.setOutputStyle(OutputStyle.NORMAL);
  ByteArrayOutputStream b = new  ByteArrayOutputStream();
  parser.compose(b, csid);
  b.close();
  return new String(b.toByteArray(), Charsets.UTF_8);
}
 
開發者ID:jamesagnew,項目名稱:hapi-fhir,代碼行數:15,代碼來源:BaseWorkerContext.java

示例13: QCodec

/**
 * Default constructor.
 */
public QCodec() {
    this(Charsets.UTF_8);
}
 
開發者ID:HTBridge,項目名稱:pivaa,代碼行數:6,代碼來源:QCodec.java

示例14: QuotedPrintableCodec

/**
 * Default constructor, assumes default charset of {@link Charsets#UTF_8}
 */
public QuotedPrintableCodec() {
    this(Charsets.UTF_8, false);
}
 
開發者ID:HTBridge,項目名稱:pivaa,代碼行數:6,代碼來源:QuotedPrintableCodec.java

示例15: BCodec

/**
 * Default constructor.
 */
public BCodec() {
    this(Charsets.UTF_8);
}
 
開發者ID:HTBridge,項目名稱:pivaa,代碼行數:6,代碼來源:BCodec.java


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