List of utility methods to do Encode
String | encode(Object o) encode return om.writeValueAsString(o);
|
byte[] | encode(Object o) encode ByteArrayOutputStream bos = new ByteArrayOutputStream(); ObjectOutputStream os = new ObjectOutputStream(bos); os.writeObject(o); os.close(); bos.close(); byte[] arr = bos.toByteArray(); return arr; |
String | encode(Object obj) json encode try { return new ObjectMapper().disable(SerializationFeature.FAIL_ON_EMPTY_BEANS).writeValueAsString(obj); } catch (IOException e) { throw new IllegalStateException(e); |
String | encode(Serializable s) encode try (ByteArrayOutputStream of = new ByteArrayOutputStream(); ObjectOutputStream so = new ObjectOutputStream(of)) { so.writeObject(s); so.flush(); return Base64.getEncoder().encodeToString(of.toByteArray()); } catch (IOException e) { throw new UnsupportedOperationException(e); |
byte[] | encode(T obj) encode byte[] bytes = null; try { ByteArrayOutputStream bout = new ByteArrayOutputStream(); ObjectOutputStream out = new ObjectOutputStream(bout); out.writeObject(obj); bytes = bout.toByteArray(); } catch (IOException e) { e.printStackTrace(); ... |
String | encode2Encode(String original, String encode1, String encode2) encode Encode if (original != null) { try { return new String(original.getBytes(encode1), encode2); } catch (UnsupportedEncodingException e) { e.printStackTrace(); return null; return null; |
byte[] | encode_u8(String what) encodu byte u8[]; if (what == null) { u8 = null; } else { try { u8 = what.getBytes("UTF-8"); } catch (UnsupportedEncodingException e) { e.printStackTrace(); ... |
InternetAddress[] | encodeAddresses(String string, String charset) Encode UTF strings into mail addresses. if (string == null) { return null; InternetAddress[] xaddresses = InternetAddress.parse(string); if (charset != null) { for (int xindex = 0; xindex < xaddresses.length; xindex++) { String xpersonal = xaddresses[xindex].getPersonal(); try { ... |
String | encodeArguments(final String arg) Encodes the arguments string. return BaseEncoding.base16().encode(arg.getBytes());
|
String[] | encodeArray(String[] sourceArray, String sysCharset, String charset) encode Array if (sourceArray == null || sourceArray.length == 0) return sourceArray; String[] result = new String[sourceArray.length]; for (int i = 0; i < sourceArray.length; i++) { result[i] = encodeString(sourceArray[i], sysCharset, charset); return result; |