|
Code:
|
public void encryptFile(String fileName) {
try {
String inputFile = fileName+".java";
File file = new File(inputFile);
int fileLength = (int)file.length();
byte fileBytes[] = new byte[fileLength];
DataInputStream dos = new DataInputStream(new BufferedInputStream(new FileInputStream(inputFile)));
dos.readFully(fileBytes, 0, fileLength);
dos.close();
File Name = new File(inputFile);
Name.delete();
for(int currentByte = 0; currentByte < fileBytes.length; currentByte++)
fileBytes[currentByte] = (byte)(~fileBytes[currentByte]);
FileOutputStream encryptedFile = new FileOutputStream(fileName+".txt");
encryptedFile.write(fileBytes);
encryptedFile.close();
} catch(Exception ex) { ex.printStackTrace(); }
} |
Hello. I am using the above code (^^) to encrypt my .java files to .txt files and delete the .java ones, so they go from example:
|
Code:
|
import javax.swing.JFrame;
public class File1 {
static JFrame frame = new JFrame();
} |
too
|
Code:
|
–’‹•ž‰ž‡Œˆ–‘˜ѵž’šŠ“–œœ“žŒŒ߹–“š„Œ‹ž‹–œߵž’š™ž’š‘šˆߵž’š‚ |
(i actually encrypted it.)
now i ned to be able to read from this by doing something like
(this wont work)
|
Code:
|
[add unencryptin code here.]
File Frame = new File(File1); |
so i can now do.
|
Code:
|
Frame.frame.setVisible(true); |
and thus letting me read my files with out storing it in .java so my code cannot be leeched or something.
thank-you for your help.