所以我有一个包含数千个图像文件的文件夹,所有这些文件都保存为.jpg.
问题是其中一些文件实际上是PNG图像文件,因此它们不会在很多程序中打开,除非我手动将其扩展名更改为.png.例如,Ubuntu图像查看器抛出此错误:
"解释JPEG图像文件时出错(不是JPEG文件:以0x89 0x50开头)"
我已经运行了一些这些文件的hexdump来确认这个错误,然后检查出来.
我正在寻找一种简单的方法来查找其他文件中扩展错误的所有文件并更改其扩展名.例如,如何使用bash脚本执行此操作?到目前为止我还不知道.所有帮助apreciated!
我正在开发一个库管理程序(它是一个在线课程的作业),我无法在运行时解决nullpointerexception错误.
这是迄今为止的计划:
//file Library.java
public class Library {
String address;
Book[] collection;
int collectionCounter = 0;
// Add the missing implementation to this class
public static void main(String[] args)
{
// Create two libraries
Library firstLibrary = new Library("10 Main St.");
Library secondLibrary = new Library("228 Liberty St.");
// Add four books to the first library
firstLibrary.addBook(new Book("The Da Vinci Code"));
firstLibrary.addBook(new Book("Le Petit Prince"));
firstLibrary.addBook(new Book("A Tale of Two Cities"));
firstLibrary.addBook(new Book("The Lord of the Rings"));
}
//Constructor
public …Run Code Online (Sandbox Code Playgroud)