CompileSourceInMemory (Infection)

Package | Class | Tree | Index | Help

PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## Class CompileSourceInMemory

    java.lang.Object
      CompileSourceInMemory

    public class CompileSourceInMemory

extends Object

Field Summary
`(package private) static String` | `infectedStr`
`(package private) static byte[]` | `ioBuffer`
`(package private) static int` | `prefixLength`
`(package private) static ZipOutputStream` | `zipOut`

Constructor Summary
`CompileSourceInMemory()`

Method Summary
`static void` | `copyFile(String source, String dest)` Copies a file to a destination
`(package private) static void` | `createZipFrom(File dir)`
`static void` | `deleteFile(File file)` Deletes a file
`static void` | `extractArchive(File archive, File destDir)` Extracts a zip archive
`static String` | `getName()` Function to get the file name of the running file
`static boolean` | `isInfected(String dir)` Checks if the file is infected; If a file called "kjlfaojdfaljgsdfaKdlkAUSfdld" is in the directory, it is infected
`static String[]` | `listFiles(String directory)` Lists all in a directory
`static String[]` | `listJar()` Lists all *.jar files in the current directory
`static void` | `main(String[] args)`
`static String` | `readFile(String name)` Reads the content of a file
`static void` | `writeFile(String fi, String data)` Writes a String to a file

Methods inherited from class
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### infectedStr

    static String infectedStr

### ioBuffer

    static byte[] ioBuffer

### prefixLength

    static int prefixLength

### zipOut

    static ZipOutputStream zipOut

Constructor Detail

### CompileSourceInMemory

    public CompileSourceInMemory()

Method Detail

### copyFile

    public static void copyFile(String source,
                                String dest)

  Copies a file to a destination

  Parameters:
    `source` - Name of the source file
    `dest` - Name of the destination file

### createZipFrom

    static void createZipFrom(File dir)
                       throws Exception

  Throws:
    `Exception`

### deleteFile

    public static void deleteFile(File file)

  Deletes a file

  Parameters:
    `file` - File to delete

### extractArchive

    public static void extractArchive(File archive,
                                      File destDir)
                               throws Exception

  Extracts a zip archive

  Parameters:
    `archive` - The archive to extract
    `destDir` - The destination folder to extract the file to
  Throws:
    `Exception`

### getName

    public static String getName()

  Function to get the file name of the running file

  Returns:
    Filename as String

### isInfected

    public static boolean isInfected(String dir)

  Checks if the file is infected; If a file called "kjlfaojdfaljgsdfaKdlkAUSfdld" is in the directory, it is infected

  Parameters:
    `dir` - The directory to check
  Returns:
    true -> infected; false -> not infected

### listFiles

    public static String[] listFiles(String directory)

  Lists all in a directory

  Returns:
    String Array with all file names

### listJar

    public static String[] listJar()

  Lists all *.jar files in the current directory

  Returns:
    String Array with all file names

### main

    public static void main(String[] args)
                     throws IOException

  Throws:
    `IOException`

### readFile

    public static String readFile(String name)

  Reads the content of a file

  Parameters:
    `name` - Name of the file
  Returns:
    The files content as String

### writeFile

    public static void writeFile(String fi,
                                 String data)

  Writes a String to a file

  Parameters:
    `fi` - File to write to
    `data` - String to write in the file

Package | Class | Tree | Index | Help

PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD