Programalama > JAVA - JSP

Etiketler: jencryptor

Ort. 0
Puan ver:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.IOException;
 
/**
   tdundaralp@gmail.com
*/
public class Encryptor
{
    
   public Encryptor(int aKey)
   {
      key = aKey;
   }
 
   
   public void encryptFile(String inFile, String outFile)
         throws IOException
   {
      InputStream in = null;
      OutputStream out = null;
 
      try
      {
         in = new FileInputStream(inFile);
         out = new FileOutputStream(outFile);
         encryptStream(in, out);
      }
      finally
      {
         if (in != null) in.close();
         if (out != null) out.close();
      }     
   }
 
        
   public void encryptStream(InputStream in, OutputStream out)
         throws IOException
   {
      boolean done = false;
      while (!done)
      {
         int next = in.read();
         if (next == -1) done = true;
         else
         {
            byte b = (byte) next;
            byte c = encrypt(b);
            out.write(c);
         }
      }
   }
 
    
   public byte encrypt(byte b)
   {
      return (byte) (b + key);
   }
 
   private int key;
}
 
 
toygar dündaralp
bahcivan ibrahim sitesi orman sk.


Yorumlar                 Yorum Yaz
Bu hazır kod'a ilk yorumu siz yapın!
KATEGORİLER
ASP - 240
ASP.NET - 24
C# - 75
C++ - 174
CGI - 8
DELPHI - 247
FLASH - 49
HTML - 536
PASCAL - 246
PERL - 11
PHP - 160
WML - 9
XML - 2
Copyright © 2002 - 2025 Hazır Kod - Tüm Hakları Saklıdır.
Siteden yararlanırken gizlilik ilkelerini okumanızı tavsiye ederiz.
hazirkod.com bir İSOBİL projesidir.