本文整理汇总了Java中com.migcomponents.migbase64.Base64类的典型用法代码示例。如果您正苦于以下问题:Java Base64类的具体用法?Java Base64怎么用?Java Base64使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Base64类属于com.migcomponents.migbase64包,在下文中一共展示了Base64类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: applyToParams
import com.migcomponents.migbase64.Base64; //导入依赖的package包/类
@Override
public void applyToParams(List<Pair> queryParams, Map<String, String> headerParams) {
if (username == null && password == null) {
return;
}
String str = (username == null ? "" : username) + ":" + (password == null ? "" : password);
try {
headerParams.put("Authorization", "Basic " + Base64.encodeToString(str.getBytes("UTF-8"), false));
} catch (UnsupportedEncodingException e) {
throw new RuntimeException(e);
}
}
开发者ID:square,项目名称:connect-java-sdk,代码行数:13,代码来源:HttpBasicAuth.java
示例2: applyToParams
import com.migcomponents.migbase64.Base64; //导入依赖的package包/类
@Override
public void applyToParams(List<Pair> queryParams, Map<String, String> headerParams) {
if (username == null && password == null) {
return;
}
String str = (username == null ? "" : username) + ":" + (password == null ? "" : password);
try {
headerParams.put("Authorization", "Basic " + Base64.encodeToString(str.getBytes("UTF-8"), false));
} catch (UnsupportedEncodingException e) {
throw new RuntimeException(e);
}
}
开发者ID:burberius,项目名称:eve-esi,代码行数:13,代码来源:HttpBasicAuth.java
示例3: test01
import com.migcomponents.migbase64.Base64; //导入依赖的package包/类
public void test01() throws IOException
{
long n = System.nanoTime();
for (int i = 0; i < 1000; i++) {
byte[] enc = Base64.encodeToByte(randomData, true);
byte[] dec = Base64.decode(enc);
}
System.out.println("Timed: " + ((System.nanoTime() - n) / 1000000f));
}
开发者ID:brsanthu,项目名称:migbase64,代码行数:12,代码来源:SimpleSpeedTest.java
示例4: toUUID
import com.migcomponents.migbase64.Base64; //导入依赖的package包/类
public UUID toUUID(JsonNode node) {
if (node.isMissingNode()) {
return null;
}
return UUIDGen.toUUID(Base64.decode(node.asText()));
}
开发者ID:mc-societies,项目名称:societies,代码行数:7,代码来源:AbstractMapper.java
示例5: toText
import com.migcomponents.migbase64.Base64; //导入依赖的package包/类
public String toText(UUID uuid) {
return Base64.encodeToString(UUIDGen.toByteArray(uuid), false);
}
开发者ID:mc-societies,项目名称:societies,代码行数:4,代码来源:AbstractMapper.java
示例6: createNode
import com.migcomponents.migbase64.Base64; //导入依赖的package包/类
public JsonNode createNode(Group group) throws IOException {
ObjectNode node = mapper.createObjectNode();
node.put("uuid", Base64.encodeToString(UUIDGen.toByteArray(group.getUUID()), false));
node.put("name", group.getName());
node.put("tag", group.getTag());
node.put("created", group.getCreated().getMillis());
Society society = group.get(Society.class);
node.put("verified", society.isVerified());
node.put("balance", society.getBalance());
node.put("ff", society.isFriendlyFire());
Optional<Location> home = society.getHome();
if (home.isPresent()) {
node.set("home", toNode(home.get()));
}
Collection<Relation> relations = group.getRelations();
ArrayNode relationsNode = node.putArray("relations");
for (Relation relation : relations) {
ObjectNode relationNode = relationsNode.addObject();
relationNode.put("target", toText(relation.getOpposite(group.getUUID())));
relationNode.put("type", relation.getType().getID());
}
Collection<Rank> ranks = group.getRanks();
if (!ranks.isEmpty()) {
ArrayNode ranksNode = node.putArray("ranks");
for (Rank rank : ranks) {
if (rank.isStatic()) {
continue;
}
ranksNode.add(createNode(rank));
}
}
return node;
}
开发者ID:mc-societies,项目名称:societies,代码行数:45,代码来源:GroupMapper.java
示例7: createCityNode
import com.migcomponents.migbase64.Base64; //导入依赖的package包/类
public ObjectNode createCityNode(City city) throws IOException {
ObjectNode node = mapper.createObjectNode();
node.put("uuid", Base64.encodeToString(UUIDGen.toByteArray(city.getUUID()), false));
node.put("name", city.getName());
Location location = city.getLocation();
node.set("location", toNode(location));
node.set("lands", createLandsNode(city.getLands()));
node.put("owner", toText(city.getOwner().getUUID()));
node.put("founded", city.getFounded().getMillis());
return node;
}
开发者ID:mc-societies,项目名称:societies,代码行数:18,代码来源:CityWriter.java
示例8: unserialise
import com.migcomponents.migbase64.Base64; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public Model unserialise(String data) throws Exception {
byte[] bytes = Base64.decode(data);
ByteArrayInputStream stream = new ByteArrayInputStream(bytes);
ObjectInputStream unserializer = new ObjectInputStream(stream);
return (Model) unserializer.readObject();
}
开发者ID:jackprice,项目名称:gatekeeper,代码行数:11,代码来源:AbstractModelBuilder.java
示例9: serialise
import com.migcomponents.migbase64.Base64; //导入依赖的package包/类
public String serialise(Model model) throws IOException {
ByteArrayOutputStream stream = new ByteArrayOutputStream();
ObjectOutputStream serializer = new ObjectOutputStream(stream);
serializer.writeObject(model);
stream.close();
return Base64.encodeToString(stream.toByteArray(), false);
}
开发者ID:jackprice,项目名称:gatekeeper,代码行数:12,代码来源:AbstractModelBuilder.java
示例10: unserialise
import com.migcomponents.migbase64.Base64; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public T unserialise(String data) throws Exception {
byte[] bytes = Base64.decode(data);
ByteArrayInputStream stream = new ByteArrayInputStream(bytes);
ObjectInputStream unserializer = new ObjectInputStream(stream);
return (T) unserializer.readObject();
}
开发者ID:jackprice,项目名称:gatekeeper,代码行数:11,代码来源:Serialiser.java
示例11: serialise
import com.migcomponents.migbase64.Base64; //导入依赖的package包/类
public String serialise(T object) throws IOException {
ByteArrayOutputStream stream = new ByteArrayOutputStream();
ObjectOutputStream serializer = new ObjectOutputStream(stream);
serializer.writeObject(object);
stream.close();
return Base64.encodeToString(stream.toByteArray(), false);
}
开发者ID:jackprice,项目名称:gatekeeper,代码行数:12,代码来源:Serialiser.java
注:本文中的com.migcomponents.migbase64.Base64类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论