「解析java源码」java 解析

博主:adminadmin 2023-03-20 12:20:11 521

今天给各位分享解析java源码的知识,其中也会对java 解析进行解释,如果能碰巧解决你现在面临的问题,别忘了关注本站,现在开始吧!

本文目录一览:

java atm源代码解析

先不说公司的保密协议

一个项目的代码能在这里全贴出来,还给你讲解的清楚?

、不过整个取款机流程是很简单的,就是用户进行不同的操作,

java 调用 JNI驱动硬件执行相应的操作,关键就是组织各种类型的报文,

通过DTU发送到银联那边,比如说支付报文,冲正报文,日结报文……

这些报文的组织一般java 也只管传入JNI 中C++组装好以后再调用 DTU驱动发送

java 这一块就是处理一些逻辑或者页面流转之类的、

代码是不可能贴的,保密协议还是有一定的约束力的

MyView myView = new MyView();

myView.anyView = this;

this.remove(this.xxPanel);

this.add(myView.getPanel());

this.repaint();

有没有解析java源代码的工具啊

你要看class的?可以用jd-gui.exe 如果要集成在eclipse里面的话,可以用jadClipse

java 解析 eml的源代码

// 从EML文件得到MimeMessage对象

MimeMessage message = new MimeMessage(session, new FileInputStream(emlFile));

public static String getMailSubject(Message message) throws Exception {

return MimeUtility.decodeText(message.getSubject());

}

public static String getMailSender(Message message) throws Exception {

String emailSender = null;

Address[] addresses = message.getFrom();

if (addresses == null || addresses.length  1) {

throw new IllegalArgumentException("该邮件没有发件人");

}

// 获得发件人

InternetAddress address = (InternetAddress) addresses[0];

String senderName = address.getPersonal();

if (senderName != null) {

senderName = MimeUtility.decodeText(senderName);

emailSender = senderName + "" + address.getAddress() + "";

} else {

senderName = address.getAddress();

}

return emailSender;

}

public static String getMailRecipients(Message message, Message.RecipientType recipientType) throws Exception {

StringBuilder builder = new StringBuilder();

Address[] addresses = null;

if (recipientType == null) {

addresses = message.getAllRecipients();

} else {

addresses = message.getRecipients(recipientType);

}

if (addresses == null || addresses.length  1) {

throw new IllegalArgumentException("该邮件没有收件人");

}

for (Address address : addresses) {

InternetAddress iAddress = (InternetAddress) address;

builder.append(iAddress.toUnicodeString()).append(", ");

}

return builder.deleteCharAt(builder.length() - 1).toString();

}

public static String getMailSendDate(Message message, String pattern) throws Exception {

String sendDateString = null;

if (pattern == null || "".equals(pattern.trim())) {

pattern = "yyyy年MM月dd日 E HH:mm";

}

Date sendDate = message.getSentDate();

sendDateString = new SimpleDateFormat(pattern).format(sendDate);

return sendDateString;

}

public static boolean containsAttachment(Part part) throws Exception {

boolean flag = false;

if (part != null) {

if (part.isMimeType("multipart/*")) {

MimeMultipart mp = (MimeMultipart) part.getContent();

for (int i = 0; i  mp.getCount(); i++) {

BodyPart bodyPart = mp.getBodyPart(i);

String disposition = bodyPart.getDisposition();

if (disposition != null  (Part.ATTACHMENT.equalsIgnoreCase(disposition)

|| Part.INLINE.equalsIgnoreCase(disposition))) {

flag = true;

} else if (bodyPart.isMimeType("multipart/*")) {

flag = containsAttachment(bodyPart);

} else {

String contentType = bodyPart.getContentType();

if (contentType.indexOf("application") != -1) {

flag = true;

}

if (contentType.indexOf("name") != -1) {

flag = true;

}

}

if (flag)

break;

}

} else if (part.isMimeType("message/rfc822")) {

flag = containsAttachment((Part) part.getContent());

}

}

return flag;

}

public static boolean isSeen(Message message) throws Exception {

if (message == null) {

throw new MessagingException("Message is empty");

}

return message.getFlags().contains(Flags.Flag.SEEN);

}

public static boolean isReplaySign(Message message) throws Exception {

if (message == null) {

throw new MessagingException("Message is empty");

}

boolean replaySign = false;

String[] headers = message.getHeader("Disposition-Notification-To");

if (headers != null  headers.length  0) {

replaySign = true;

}

return replaySign;

}

public static String getMailPriority(Message message) throws Exception {

if (message == null) {

throw new MessagingException("Message is empty");

}

String priority = "普通";

String[] headers = message.getHeader("X-Priority");

if (headers != null  headers.length  0) {

String mailPriority = headers[0];

if (mailPriority.indexOf("1") != -1 || mailPriority.indexOf("High") != -1) {

priority = "紧急";

} else if (mailPriority.indexOf("5") != -1 || mailPriority.indexOf("Low") != -1) {

priority = "低";

} else {

priority = "普通"; // 3或者Normal;

}

}

return priority;

}

public static void getMailTextContent(Part part, StringBuilder content) throws Exception {

if (part == null) {

throw new MessagingException("Message content is empty");

}

boolean containsTextInAttachment = part.getContentType().indexOf("name")  0;

if (part.isMimeType("text/*")  containsTextInAttachment) {

content.append(part.getContent().toString());

} else if (part.isMimeType("message/rfc822")) {

getMailTextContent((Part) part.getContent(), content);

} else if (part.isMimeType("multipart/*")) {

Multipart mp = (Multipart) part.getContent();

for (int i = 0; i  mp.getCount(); i++) {

BodyPart bodyPart = mp.getBodyPart(i);

getMailTextContent(bodyPart, content);

}

} else if (part.isMimeType("image/*")) {

// TODO part.getInputStream()获得输入流然后输出到指定的目录

} else {

// TODO 其它类型的contentType, 未做处理, 直接输出

content.append(part.getContent().toString());

}

}

public static void saveAttachment(Part part, String destDir) throws Exception {

if (part == null) {

throw new MessagingException("part is empty");

}

// 复杂的邮件包含多个邮件体

if (part.isMimeType("multipart/*")) {

Multipart mp = (Multipart) part.getContent();

// 遍历每一个邮件体

for (int i = 0; i  mp.getCount(); i++) {

BodyPart bodyPart = mp.getBodyPart(i);

// bodyPart也可能有多个邮件体组成

String disposition = bodyPart.getDisposition();

if (disposition == null  (Part.ATTACHMENT.equalsIgnoreCase(disposition)

|| Part.INLINE.equalsIgnoreCase(disposition))) {

InputStream in = bodyPart.getInputStream();

saveFile(in, destDir, decodeText(bodyPart.getFileName()));

} else if (bodyPart.isMimeType("multipart/*")) {

saveAttachment(bodyPart, destDir);

} else {

String contentType = bodyPart.getContentType();

if (contentType.indexOf("name") != -1 || contentType.indexOf("application") != -1) {

saveFile(bodyPart.getInputStream(), destDir, decodeText(bodyPart.getFileName()));

}

}

}

} else if (part.isMimeType("message/rfc822")) {

saveAttachment((Part) part.getContent(), destDir);

}

}

public static void saveFile(InputStream in, String destDir, String fileName) throws Exception {

FileOutputStream out = new FileOutputStream(new File(destDir + fileName));

byte[] buffer = new byte[1024];

int length = 0;

while ((length = in.read(buffer)) != -1) {

out.write(buffer, 0, length);

}

out.close();

in.close();

}

public static String decodeText(String encodedText) throws Exception {

if (encodedText == null || "".equals(encodedText.trim())) {

return "";

} else {

return MimeUtility.decodeText(encodedText);

}

}

java源代码怎么打开

源代码默认是打不开的,可以使用反编译工具,进行逆向解析才能看到源代码。

eclipse这个开发工具,默认有反编译的插件,在查看的类,按住ctrl点击鼠标左键即可查看源代码。

解析java源码的介绍就聊到这里吧,感谢你花时间阅读本站内容,更多关于java 解析、解析java源码的信息别忘了在本站进行查找喔。