some refactor
This commit is contained in:
parent
aaf5ea7ce9
commit
0a3f3e75e0
@ -887,27 +887,7 @@ public class FileOperations {
|
|||||||
}
|
}
|
||||||
boolean contentMatched = true;
|
boolean contentMatched = true;
|
||||||
if (nameMatched && contentPattern != null) {
|
if (nameMatched && contentPattern != null) {
|
||||||
final SevenZFile szfFinal = sevenZFile;
|
contentMatched = searchInSevenZEntry(sevenZFile, contentPattern);
|
||||||
InputStream is = new InputStream() {
|
|
||||||
@Override
|
|
||||||
public int read() throws IOException {
|
|
||||||
try {
|
|
||||||
return szfFinal.read();
|
|
||||||
} catch (PasswordRequiredException e) {
|
|
||||||
throw new IOException("Password required", e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int read(byte[] b, int off, int len) throws IOException {
|
|
||||||
try {
|
|
||||||
return szfFinal.read(b, off, len);
|
|
||||||
} catch (PasswordRequiredException e) {
|
|
||||||
throw new IOException("Password required", e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
contentMatched = searchInStream(is, contentPattern);
|
|
||||||
}
|
}
|
||||||
if (nameMatched && contentMatched) {
|
if (nameMatched && contentMatched) {
|
||||||
callback.onFileFound(archive, archive.getAbsolutePath() + File.separator + entry.getName());
|
callback.onFileFound(archive, archive.getAbsolutePath() + File.separator + entry.getName());
|
||||||
@ -967,6 +947,16 @@ public class FileOperations {
|
|||||||
} catch (Exception ignore) {}
|
} catch (Exception ignore) {}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static boolean searchInSevenZEntry(SevenZFile sevenZFile, Pattern contentPattern) throws IOException {
|
||||||
|
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||||
|
byte[] buffer = new byte[65536];
|
||||||
|
int len;
|
||||||
|
while ((len = sevenZFile.read(buffer)) > 0) {
|
||||||
|
baos.write(buffer, 0, len);
|
||||||
|
}
|
||||||
|
return contentPattern.matcher(new String(baos.toByteArray())).find();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Zip files/directories into a target zip file
|
* Zip files/directories into a target zip file
|
||||||
|
|||||||
@ -10,7 +10,6 @@ import org.apache.commons.net.ftp.FTPFile;
|
|||||||
import org.apache.commons.net.ftp.FTPReply;
|
import org.apache.commons.net.ftp.FTPReply;
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.text.SimpleDateFormat;
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -729,9 +729,6 @@ public class FilePanel extends JPanel {
|
|||||||
*/
|
*/
|
||||||
public void setActive(boolean active, Color activeColor) {
|
public void setActive(boolean active, Color activeColor) {
|
||||||
this.active = active;
|
this.active = active;
|
||||||
// Inactive indicator is subtle dark gray
|
|
||||||
Color inactiveColor = new Color(60, 60, 60);
|
|
||||||
Color targetColor = active ? activeColor : inactiveColor;
|
|
||||||
|
|
||||||
// Remove the horizontal line above tabs.
|
// Remove the horizontal line above tabs.
|
||||||
tabbedPane.setBorder(null);
|
tabbedPane.setBorder(null);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user