最后
本人也收藏了一份Java面试核心知识点来应付面试,借着这次机会可以送给我的读者朋友们:
目录:
Java面试核心知识点
一共有30个专题,足够读者朋友们应付面试啦,也节省朋友们去到处搜刮资料自己整理的时间!
Java面试核心知识点
resourceGet(file, keyWords);
}
} else {
resourceGet(file, keyWords);
}
}
private void resourceGet(File file, String keyWords) {
InputStream inputStream = null;
FileOutputStream fileOutputStream = null;
try {
//创建url连接
URL url = new URL(“https://image.baidu.com/search/index” +
“?tn=baiduimage&ps=1&ct=201326592&lm=-1&cl=2&nc=1&ie=utf-8&word=” + keyWords);
//打开资源
inputStream = url.openStream();
//字节数组用于临时存储资源
byte[] buffer = new byte[1024];
//使用StringBuilder保存获取的所有资源
StringBuilder allResource = new StringBuilder();
int len = -1;
while ((len = inputStream.read(buffer)) != -1) {
//获取到了资源
allResource.append(new String(buffer, 0, len, StandardCharsets.UTF_8));
}
//使用图片资源的正则表达式获取我们想要的资源
String allPictureResource = allResource.toString();
Pattern compile = Pattern.compile(“https://.*?0\.jpg”);
//使用匹配器匹配我们想要的资源
Matcher matcher = compile.matcher(allPictureResource);
//查看是否有匹配到的东西 如果有就获取该资源
List haveDown = new ArrayList<>();
int count = 1;
System.out.println(“开始爬取…”);
while (matcher.find() ) {
//System.out.println(“正在爬取第” + count++ + “张…”);
System.out.println(“正在爬取ing…”);
//获取匹配到的一条结果
String pictureResource = matcher.group();
//如果这个资源的照片已经下载过就不进行再次下载
if (haveDown.contains(pictureResource)) {
continue;
}
//与这个图片资源获得连接
URL pictureURL = new URL(pictureResource);
inputStream = pictureURL.openStream();
//创建文件输出流
fileOutputStream = new FileOutputStream(file.getPath() + “/” + System.currentTimeMillis() + “.jpg”);
//输入到文件中
while ((len = inputStream.read(buffer)) != -1) {
fileOutputStream.write(buffer, 0, len);
}
//关闭资源
fileOutputStream.flush();
fileOutputStream.close();
inputStream.close();
haveDown.add(pictureResource);
//System.out.println(“爬取第” + count++ + “张完毕…”);
}
} catch (IOException e) {
e.printStackTrace();
System.out.println(“爬取失败…”);
} finally {
if (inputStream != null) {
try {
inputStream.close();
} catch (IOException e) {
e.printStackTrace();
}
}
if (fileOutputStream != null) {
try {
fileOutputStream.close();
} catch (IOException e) {
e.printStackTrace();
}
}
System.out.println(“爬取成功…”);
}
}
}
import java.util.Scanner;
/**
-
Created with IntelliJ IDEA.
-
Description: If you don’t work hard, you will a loser.
-
User: Listen-Y.
-
Date: 2020-09-02
-
Time: 22:02
*/
public class Test {
感受:
其实我投简历的时候,都不太敢投递阿里。因为在阿里一面前已经过了字节的三次面试,投阿里的简历一直没被捞,所以以为简历就挂了。
特别感谢一面的面试官捞了我,给了我机会,同时也认可我的努力和态度。对比我的面经和其他大佬的面经,自己真的是运气好。别人8成实力,我可能8成运气。所以对我而言,我要继续加倍努力,弥补自己技术上的不足,以及与科班大佬们基础上的差距。希望自己能继续保持学习的热情,继续努力走下去。
也祝愿各位同学,都能找到自己心动的offer。
分享我在这次面试前所做的准备(刷题复习资料以及一些大佬们的学习笔记和学习路线),都已经整理成了电子文档
-jidnXqv7-1715631761924)]