-
Notifications
You must be signed in to change notification settings - Fork 222
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
'#43 initial file hook implementations.
- Loading branch information
1 parent
715d5d5
commit 0ff7e5d
Showing
2 changed files
with
94 additions
and
1 deletion.
There are no files selected for viewing
57 changes: 57 additions & 0 deletions
57
iped-utils/src/main/java/iped/utils/pythonhook/FileHook.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
package iped.utils.pythonhook; | ||
|
||
import java.io.File; | ||
import java.io.FileInputStream; | ||
import java.io.FileNotFoundException; | ||
import java.io.IOException; | ||
import java.util.Collection; | ||
|
||
public class FileHook { | ||
FileInputStream fis; | ||
File f; | ||
|
||
public FileHook(String path, String... args) { | ||
f = new File(path); | ||
} | ||
|
||
public FileHook(String path, String mode) { | ||
f = new File(path); | ||
} | ||
|
||
public FileHook(String path) { | ||
this(path, "r"); | ||
} | ||
|
||
public String read() throws FileNotFoundException { | ||
if (fis == null) { | ||
fis = new FileInputStream(f); | ||
} | ||
return "old"; | ||
} | ||
|
||
public void enter() { | ||
try { | ||
System.out.println("Enter:" + f.getCanonicalPath()); | ||
} catch (IOException e) { | ||
// TODO Auto-generated catch block | ||
e.printStackTrace(); | ||
} | ||
} | ||
|
||
public void exit(Collection args) { | ||
try { | ||
System.out.println("Exit:" + f.getCanonicalPath()); | ||
} catch (IOException e) { | ||
// TODO Auto-generated catch block | ||
e.printStackTrace(); | ||
} | ||
} | ||
|
||
public void close() throws IOException { | ||
if (fis != null) { | ||
fis.close(); | ||
} | ||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters