eu.steffo.cleaver.logic.stream.output.CleaverCryptOutputStream (implements eu.steffo.cleaver.logic.stream.output.ICleaverOutputStream )
+eu.steffo.cleaver.logic.stream.output.CleaverSimpleFileOutputStream (implements eu.steffo.cleaver.logic.stream.output.ICleaverOutputStream )
java.util.zip.DeflaterOutputStream
+eu.steffo.cleaver.logic.utils.SafeLongToInt
eu.steffo.cleaver.logic.utils.SaltSerializer
eu.steffo.cleaver.logic.config.SizeConfig (implements eu.steffo.cleaver.logic.config.ISplitConfig )
java.lang.Thread (implements java.lang.Runnable )
diff --git a/docs/serialized-form.html b/docs/serialized-form.html
index 5b2f793..1a1eca3 100644
--- a/docs/serialized-form.html
+++ b/docs/serialized-form.html
@@ -2,10 +2,10 @@
-
-Serialized Form
+
+Serialized Form (Cleaver)
-
+
@@ -471,13 +471,13 @@ $('.navPadding').css('padding-top', $('.fixedNav').css("height"));
If unticked, CryptRow.getCryptConfig()
will return null.
-keyLabel
-JLabel keyLabel
-A label with "Key" written on it.
+passwordLabel
+JLabel passwordLabel
+A label with "Password" written on it.
-keyTextField
-JTextField keyTextField
+passwordTextField
+JTextField passwordTextField
The
JTextField
where the user can input the desired encryption key for the files, in form of a
String
.
@@ -502,20 +502,20 @@ $('.navPadding').css('padding-top', $('.fixedNav').css("height"));
Serialized Fields
-keyLabel
-JLabel keyLabel
-A label with "Encryption key" written on it.
-
-
-keyTextField
-JTextField keyTextField
-The text field where the user can input the encryption key.
-
-
optionalLabel
JLabel optionalLabel
A label with "(if required)" written on it.
+
+passwordLabel
+JLabel passwordLabel
+A label with "Password" written on it.
+
+
+passwordTextField
+JTextField passwordTextField
+The text field where the user can input the encryption key.
+
diff --git a/docs/style.css b/docs/style.css
index 0b0e99c..bb95c0a 100644
--- a/docs/style.css
+++ b/docs/style.css
@@ -1,3 +1,5 @@
+/* "blood" theme for javadoc by Stefano Pigozzi */
+
.topNav, .bottomNav {
background-color: #440000 !important;
}
@@ -31,6 +33,7 @@ a:hover, a:active {
color: #F8981D !important;
}
-body, .overviewSummary caption, .memberSummary caption, .typeSummary caption, .useSummary caption, .constantsSummary caption, .deprecatedSummary caption, .requiresSummary caption, .packagesSummary caption, .providesSummary caption, .usesSummary caption {
+body, .overviewSummary caption, .memberSummary caption, .typeSummary caption, .useSummary caption, .constantsSummary caption, .deprecatedSummary caption,
+.requiresSummary caption, .packagesSummary caption, .providesSummary caption, .usesSummary caption {
color: black;
}
\ No newline at end of file
diff --git a/docs/type-search-index.js b/docs/type-search-index.js
index bd6b947..b6d77f8 100644
--- a/docs/type-search-index.js
+++ b/docs/type-search-index.js
@@ -1 +1 @@
-typeSearchIndex = [{"l":"All Classes","url":"allclasses-index.html"},{"p":"eu.steffo.cleaver.gui.panels","l":"ChopAndStitchPanel"},{"p":"eu.steffo.cleaver.logic.job","l":"ChopJob"},{"p":"eu.steffo.cleaver.gui.panels","l":"ChopPanel"},{"p":"eu.steffo.cleaver.errors","l":"ChpFileError"},{"p":"eu.steffo.cleaver.logic.stream.input","l":"CleaverCryptInputStream"},{"p":"eu.steffo.cleaver.logic.stream.output","l":"CleaverCryptOutputStream"},{"p":"eu.steffo.cleaver.logic.stream.input","l":"CleaverDeflateInputStream"},{"p":"eu.steffo.cleaver.logic.stream.output","l":"CleaverDeflateOutputStream"},{"p":"eu.steffo.cleaver.logic.stream.input","l":"CleaverForkFileInputStream"},{"p":"eu.steffo.cleaver.logic.stream.output","l":"CleaverForkFileOutputStream"},{"p":"eu.steffo.cleaver.gui","l":"CleaverFrame"},{"p":"eu.steffo.cleaver.logic.stream.input","l":"CleaverSimpleFileInputStream"},{"p":"eu.steffo.cleaver.logic.stream.output","l":"CleaverSimpleFileOutputStream"},{"p":"eu.steffo.cleaver.logic.stream.input","l":"CleaverSplitFileInputStream"},{"p":"eu.steffo.cleaver.logic.stream.output","l":"CleaverSplitFileOutputStream"},{"p":"eu.steffo.cleaver.gui.panels.rows.option","l":"CompressRow"},{"p":"eu.steffo.cleaver.gui.panels.rows","l":"CreateJobButtonRow"},{"p":"eu.steffo.cleaver.gui.panels","l":"CreateJobPanel"},{"p":"eu.steffo.cleaver.gui.panels.rows.option","l":"CryptRow"},{"p":"eu.steffo.cleaver.logic.config","l":"DeflateConfig"},{"p":"eu.steffo.cleaver.logic.progress","l":"ErrorProgress"},{"p":"eu.steffo.cleaver.gui.panels.rows","l":"FileSelectRow"},{"p":"eu.steffo.cleaver.logic.progress","l":"FinishedProgress"},{"p":"eu.steffo.cleaver.logic.stream.input","l":"ICleaverInputStream"},{"p":"eu.steffo.cleaver.logic.stream.output","l":"ICleaverOutputStream"},{"p":"eu.steffo.cleaver.logic.stream","l":"ICleaverStream"},{"p":"eu.steffo.cleaver.logic.config","l":"ICompressConfig"},{"p":"eu.steffo.cleaver.logic.config","l":"IConfig"},{"p":"eu.steffo.cleaver.logic.config","l":"ICryptConfig"},{"p":"eu.steffo.cleaver.logic.config","l":"ISplitConfig"},{"p":"eu.steffo.cleaver.logic.job","l":"Job"},{"p":"eu.steffo.cleaver.gui.panels","l":"JobsButtonsPanel"},{"p":"eu.steffo.cleaver.gui.panels","l":"JobsTablePanel.JobsTableModel"},{"p":"eu.steffo.cleaver.gui.panels","l":"JobsTablePanel"},{"p":"eu.steffo.cleaver.gui.panels.rows.option","l":"KeyRow"},{"p":"eu.steffo.cleaver","l":"Main"},{"p":"eu.steffo.cleaver.logic.progress","l":"NotStartedProgress"},{"p":"eu.steffo.cleaver.gui.panels.rows.option","l":"OptionRow"},{"p":"eu.steffo.cleaver.logic.config","l":"PartsConfig"},{"p":"eu.steffo.cleaver.logic.config","l":"PasswordConfig"},{"p":"eu.steffo.cleaver.errors","l":"ProgrammingError"},{"p":"eu.steffo.cleaver.logic.progress","l":"Progress"},{"p":"eu.steffo.cleaver.gui.panels.rows","l":"Row"},{"p":"eu.steffo.cleaver.logic.utils","l":"SaltSerializer"},{"p":"eu.steffo.cleaver.logic.config","l":"SizeConfig"},{"p":"eu.steffo.cleaver.gui.panels.rows.option","l":"SplitRow"},{"p":"eu.steffo.cleaver.logic.job","l":"StitchJob"},{"p":"eu.steffo.cleaver.gui.panels","l":"StitchPanel"},{"p":"eu.steffo.cleaver.gui.panels.rows","l":"TitleRow"},{"p":"eu.steffo.cleaver.logic.progress","l":"WorkingProgress"}]
\ No newline at end of file
+typeSearchIndex = [{"l":"All Classes","url":"allclasses-index.html"},{"p":"eu.steffo.cleaver.gui.panels","l":"ChopAndStitchPanel"},{"p":"eu.steffo.cleaver.logic.job","l":"ChopJob"},{"p":"eu.steffo.cleaver.gui.panels","l":"ChopPanel"},{"p":"eu.steffo.cleaver.errors","l":"ChpFileError"},{"p":"eu.steffo.cleaver.logic.stream.input","l":"CleaverCryptInputStream"},{"p":"eu.steffo.cleaver.logic.stream.output","l":"CleaverCryptOutputStream"},{"p":"eu.steffo.cleaver.logic.stream.input","l":"CleaverDeflateInputStream"},{"p":"eu.steffo.cleaver.logic.stream.output","l":"CleaverDeflateOutputStream"},{"p":"eu.steffo.cleaver.logic.stream.input","l":"CleaverForkFileInputStream"},{"p":"eu.steffo.cleaver.logic.stream.output","l":"CleaverForkFileOutputStream"},{"p":"eu.steffo.cleaver.gui","l":"CleaverFrame"},{"p":"eu.steffo.cleaver.logic.stream.input","l":"CleaverSimpleFileInputStream"},{"p":"eu.steffo.cleaver.logic.stream.output","l":"CleaverSimpleFileOutputStream"},{"p":"eu.steffo.cleaver.logic.stream.input","l":"CleaverSplitFileInputStream"},{"p":"eu.steffo.cleaver.logic.stream.output","l":"CleaverSplitFileOutputStream"},{"p":"eu.steffo.cleaver.gui.panels.rows.option","l":"CompressRow"},{"p":"eu.steffo.cleaver.gui.panels.rows","l":"CreateJobButtonRow"},{"p":"eu.steffo.cleaver.gui.panels","l":"CreateJobPanel"},{"p":"eu.steffo.cleaver.gui.panels.rows.option","l":"CryptRow"},{"p":"eu.steffo.cleaver.logic.config","l":"DeflateConfig"},{"p":"eu.steffo.cleaver.logic.progress","l":"ErrorProgress"},{"p":"eu.steffo.cleaver.gui.panels.rows","l":"FileSelectRow"},{"p":"eu.steffo.cleaver.logic.progress","l":"FinishedProgress"},{"p":"eu.steffo.cleaver.logic.stream.input","l":"ICleaverInputStream"},{"p":"eu.steffo.cleaver.logic.stream.output","l":"ICleaverOutputStream"},{"p":"eu.steffo.cleaver.logic.stream","l":"ICleaverStream"},{"p":"eu.steffo.cleaver.logic.config","l":"ICompressConfig"},{"p":"eu.steffo.cleaver.logic.config","l":"IConfig"},{"p":"eu.steffo.cleaver.logic.config","l":"ICryptConfig"},{"p":"eu.steffo.cleaver.logic.config","l":"ISplitConfig"},{"p":"eu.steffo.cleaver.logic.job","l":"Job"},{"p":"eu.steffo.cleaver.gui.panels","l":"JobsButtonsPanel"},{"p":"eu.steffo.cleaver.gui.panels","l":"JobsTablePanel.JobsTableModel"},{"p":"eu.steffo.cleaver.gui.panels","l":"JobsTablePanel"},{"p":"eu.steffo.cleaver.gui.panels.rows.option","l":"KeyRow"},{"p":"eu.steffo.cleaver","l":"Main"},{"p":"eu.steffo.cleaver.logic.progress","l":"NotStartedProgress"},{"p":"eu.steffo.cleaver.gui.panels.rows.option","l":"OptionRow"},{"p":"eu.steffo.cleaver.logic.config","l":"PartsConfig"},{"p":"eu.steffo.cleaver.logic.config","l":"PasswordConfig"},{"p":"eu.steffo.cleaver.errors","l":"ProgrammingError"},{"p":"eu.steffo.cleaver.logic.progress","l":"Progress"},{"p":"eu.steffo.cleaver.gui.panels.rows","l":"Row"},{"p":"eu.steffo.cleaver.logic.utils","l":"SafeLongToInt"},{"p":"eu.steffo.cleaver.logic.utils","l":"SaltSerializer"},{"p":"eu.steffo.cleaver.logic.config","l":"SizeConfig"},{"p":"eu.steffo.cleaver.gui.panels.rows.option","l":"SplitRow"},{"p":"eu.steffo.cleaver.logic.job","l":"StitchJob"},{"p":"eu.steffo.cleaver.gui.panels","l":"StitchPanel"},{"p":"eu.steffo.cleaver.gui.panels.rows","l":"TitleRow"},{"p":"eu.steffo.cleaver.logic.progress","l":"WorkingProgress"}]
\ No newline at end of file
diff --git a/resources/style.css b/resources/style.css
index 0b0e99c..bb95c0a 100644
--- a/resources/style.css
+++ b/resources/style.css
@@ -1,3 +1,5 @@
+/* "blood" theme for javadoc by Stefano Pigozzi */
+
.topNav, .bottomNav {
background-color: #440000 !important;
}
@@ -31,6 +33,7 @@ a:hover, a:active {
color: #F8981D !important;
}
-body, .overviewSummary caption, .memberSummary caption, .typeSummary caption, .useSummary caption, .constantsSummary caption, .deprecatedSummary caption, .requiresSummary caption, .packagesSummary caption, .providesSummary caption, .usesSummary caption {
+body, .overviewSummary caption, .memberSummary caption, .typeSummary caption, .useSummary caption, .constantsSummary caption, .deprecatedSummary caption,
+.requiresSummary caption, .packagesSummary caption, .providesSummary caption, .usesSummary caption {
color: black;
}
\ No newline at end of file
diff --git a/src/eu/steffo/cleaver/Main.java b/src/eu/steffo/cleaver/Main.java
index 64dbc3b..c902255 100644
--- a/src/eu/steffo/cleaver/Main.java
+++ b/src/eu/steffo/cleaver/Main.java
@@ -9,7 +9,7 @@ import java.util.ArrayList;
/**
* The class containing the main function.
*/
-public class Main {
+public final class Main {
/**
* The {@link ArrayList} of {@link Job Jobs} that the {@link CleaverFrame} will manipulate.
*
@@ -30,4 +30,9 @@ public class Main {
cf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
cf.setVisible(true);
}
+
+ /**
+ * Disallow instantiations of this class.
+ */
+ private Main() {}
}
diff --git a/src/eu/steffo/cleaver/logic/job/ChopJob.java b/src/eu/steffo/cleaver/logic/job/ChopJob.java
index 7df0a96..8518e33 100644
--- a/src/eu/steffo/cleaver/logic/job/ChopJob.java
+++ b/src/eu/steffo/cleaver/logic/job/ChopJob.java
@@ -184,10 +184,48 @@ public class ChopJob extends Job {
}
/**
- * Generate the element tree by calling the {@link ICleaverOutputStream#toElement(Document)} method on the passed {@link OutputStream} and by writing the
- * results on a file with a {@link Transformer}.
+ *
+ * Generate the *.chp file for this job by calling the {@link ICleaverOutputStream#toElement(Document)} method of the passed {@link OutputStream} and by
+ * writing the results on a file with a {@link Transformer}.
+ *
+ *
+ * *.chp files are special XML files that contain information about the stream chain used to produce the *.cXX files.
+ *
+ *
+ * Every *.chp file has a {@literal } element as root containing all the information required to reconstruct the original file.
+ *
+ *
+ * Every element below the root represents either a {@link FilterOutputStream} that wraps the stream represented by its child, or, if the child node is
+ * {@literal }, a {@link OutputStream} reading from the {@link File} having the {@link Element#getTextContent() text content}
+ * of the {@literal } element as name.
+ *
+ *
+ * Possible tags representing {@link FilterOutputStream FilterOutputStreams} are:
+ *
+ *
+ * {@literal }, representing a {@link CleaverCryptOutputStream};
+ * {@literal }, representing a {@link CleaverDeflateOutputStream}.
+ *
+ *
+ * Possible tags representing {@link OutputStream simple OutputStreams} are:
+ *
+ *
+ * {@literal }, representing a {@link CleaverSimpleFileOutputStream};
+ * {@literal }, representing a {@link CleaverSplitFileOutputStream};
+ * {@literal }, representing a {@link CleaverForkFileOutputStream}.
+ *
+ *
+ * Elements may include attributes that useful or required to reconstruct the original file: for example, the {@literal } tag includes the value of
+ * the salt used to generate the AES key and the value of the initialization vector used to encrypt the stream.
+ *
+ * Example
+ *
+ * {@literal AllThreeExample.png }
+ *
+ *
* @param outputStream The {@link OutputStream} to create the *.chp file for.
- */
+ * @see eu.steffo.cleaver.logic.stream.input.ICleaverInputStream#fromElement(Element, File, String)
+ * */
protected void createChpFile(OutputStream outputStream) {
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder;
diff --git a/src/eu/steffo/cleaver/logic/job/package-info.java b/src/eu/steffo/cleaver/logic/job/package-info.java
index 609c4ba..692c237 100644
--- a/src/eu/steffo/cleaver/logic/job/package-info.java
+++ b/src/eu/steffo/cleaver/logic/job/package-info.java
@@ -1,4 +1,4 @@
/**
- * The package containing all possible {@link eu.steffo.cleaver.logic.job.Job Jobs}.
+ * The package containing all possible {@link eu.steffo.cleaver.logic.job.Job Jobs} that Cleaver can execute.
*/
package eu.steffo.cleaver.logic.job;
diff --git a/src/eu/steffo/cleaver/logic/package-info.java b/src/eu/steffo/cleaver/logic/package-info.java
deleted file mode 100644
index d58bde9..0000000
--- a/src/eu/steffo/cleaver/logic/package-info.java
+++ /dev/null
@@ -1,10 +0,0 @@
-/**
- * A package containing the core logic of the program.
- *
- * @see eu.steffo.cleaver.logic.config;
- * @see eu.steffo.cleaver.logic.job;
- * @see eu.steffo.cleaver.logic.progress;
- * @see eu.steffo.cleaver.logic.stream;
- * @see eu.steffo.cleaver.logic.utils;
- */
-package eu.steffo.cleaver.logic;
diff --git a/src/eu/steffo/cleaver/logic/stream/input/ICleaverInputStream.java b/src/eu/steffo/cleaver/logic/stream/input/ICleaverInputStream.java
index 42b517b..78ee242 100644
--- a/src/eu/steffo/cleaver/logic/stream/input/ICleaverInputStream.java
+++ b/src/eu/steffo/cleaver/logic/stream/input/ICleaverInputStream.java
@@ -8,6 +8,7 @@ import org.w3c.dom.Element;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
+import java.io.OutputStream;
/**
* A {@link ICleaverStream} that is also a {@link InputStream} (a stream you can read bytes from).
@@ -15,25 +16,45 @@ import java.io.InputStream;
*/
public interface ICleaverInputStream extends ICleaverStream {
/**
+ *
* Construct a ICleaverInputStream from a XML tag.
- * @param element The XML tag.
+ *
+ *
+ * Based on the input {@link Element#getTagName() tagName}, a different ICleaverInputStream is created:
+ *
+ *
+ * {@literal } tags create a {@link CleaverCryptInputStream} with the salt and iv respectively
+ * {@link SaltSerializer#deserialize(String) deserialized} from the salt
and iv
attributes, wrapping the ICleaverInputStream
+ * recursively created from its child;
+ * {@literal } tags create a {@link CleaverDeflateInputStream} wrapping the ICleaverInputStream recursively created from its child;
+ * {@literal } tags create a {@link CleaverSimpleFileInputStream} with the {@link File} specified in the child {@literal }
+ * tag;
+ * {@literal } tags create a {@link CleaverSplitFileInputStream} with the {@link File} specified in the child {@literal }
+ * tag and the part size specified in the part-size
attribute;
+ * {@literal }, representing a {@link CleaverForkFileInputStream} with the {@link File} specified in the child {@literal }
+ * tag and the number of parts specified in the parts
attribute;
+ *
+ *
+ * @param element The XML {@link Element} to construct the ICleaverInputStream from.
* @param chpFileDirectory The directory in which the *.chp file is located.
- * @param key The key to use in case <Crypt> tags are present.
+ * @param password The password to use in case <Crypt> tags are present.
* @throws ChpFileError If an unknown tag is encountered.
* @throws IOException If something goes wrong while opening the streams ({@link java.io.FileNotFoundException missing files}, insufficient permissions,
* ...)
* @return The created ICleaverInputStream.
+ * @see eu.steffo.cleaver.logic.job.ChopJob
+ * @see SaltSerializer
*/
- static InputStream fromElement(Element element, File chpFileDirectory, String key) throws ChpFileError, IOException {
+ static InputStream fromElement(Element element, File chpFileDirectory, String password) throws ChpFileError, IOException {
String tagName = element.getTagName();
switch (tagName) {
case "Crypt":
- InputStream cryptChild = fromElement((Element)element.getFirstChild(), chpFileDirectory, key);
+ InputStream cryptChild = fromElement((Element)element.getFirstChild(), chpFileDirectory, password);
byte[] salt = SaltSerializer.deserialize(element.getAttribute("salt"));
byte[] iv = SaltSerializer.deserialize(element.getAttribute("iv"));
- return new CleaverCryptInputStream(cryptChild, key.toCharArray(), salt, iv);
+ return new CleaverCryptInputStream(cryptChild, password.toCharArray(), salt, iv);
case "Deflate":
- InputStream deflateChild = fromElement((Element)element.getFirstChild(), chpFileDirectory, key);
+ InputStream deflateChild = fromElement((Element)element.getFirstChild(), chpFileDirectory, password);
return new CleaverDeflateInputStream(deflateChild);
case "Fork":
int parts = Integer.parseInt(element.getAttribute("parts"));
diff --git a/src/module-info.java b/src/module-info.java
index 58db38e..372228a 100644
--- a/src/module-info.java
+++ b/src/module-info.java
@@ -1,10 +1,38 @@
+import org.w3c.dom.Element;
+
+import java.io.File;
+
/**
+ *
* A file compression, encryption and splitting utility in Java.
- *
+ *
+ *
* It includes a easy to use {@link javax.swing} GUI.
- *
- *
- *
+ *
+ *
+ *
+ *
+ *
+ * It can chop regular files into a *.chp metadata file and multiple *.cXX (where XX is a number from 1 to {@link Integer#MAX_VALUE}) data files, which
+ * can then be stitch ed together to recreate the original file.
+ *
+ *
+ * Multiple options can be selected while chopping files:
+ *
+ *
+ * They can be split into multiple parts having a specific file size ("Split")
+ * They can be split into a specific number of parts having the same file size ("Fork")
+ * They can be encrypted with a password ("Crypt")
+ * They can be compressed to use less hard drive space ("Deflate")
+ *
+ *
+ * Multiple files can be chopped or stitched at a time: each operation is run in a separate {@link Thread} called {@link eu.steffo.cleaver.logic.job.Job Job}
+ * that performs the task independently from the other Jobs.
+ *
+ *
+ * *.chp files are documented {@link eu.steffo.cleaver.logic.job.ChopJob here} and
+ * {@link eu.steffo.cleaver.logic.stream.input.ICleaverInputStream#fromElement(Element, File, String) here}.
+ *
* @author Stefano Pigozzi
*/
open module eu.steffo.cleaver {