Added and Fixed lots of JavaDocs

This commit is contained in:
Sn0wStorm
2019-11-25 22:16:16 +01:00
parent c287b6350f
commit 16c03f9da1
32 changed files with 513 additions and 308 deletions
@@ -11,8 +11,8 @@ import java.util.List;
/**
* A Scramble Stream that uses XOR operations to unscramble an inputstream.
* a byte generator feeded with the seed is used as xor source
* Used to unscramble data generated by the XORScrambleStream
* <p>a byte generator feeded with the seed is used as xor source
* <p>Used to unscramble data generated by the XORScrambleStream
*/
public class XORUnscrambleStream extends FilterInputStream {
@@ -26,7 +26,7 @@ public class XORUnscrambleStream extends FilterInputStream {
private SuccessType successType = SuccessType.NONE;
/**
* Create a new instance of an XORUnscrambler, unscrambling the given inputstream
* Create a new instance of an XORUnscrambler, unscrambling the given inputstream.
*
* @param in The Inputstream to be unscrambled
* @param seed The seed used for unscrambling
@@ -38,11 +38,12 @@ public class XORUnscrambleStream extends FilterInputStream {
}
/**
* Create a new instance of an XORUnscrambler, unscrambling the given inputstream
* If given a List of previous Seeds, the unscrambler will try all of them for unscrambling the stream in case the seed fails.
* Create a new instance of an XORUnscrambler, unscrambling the given inputstream.
* <p>If given a List of previous Seeds, the unscrambler will try all of them for unscrambling the stream in case the seed fails.
*
* @param in The Inputstream to be unscrambled
* @param seed The seed used for unscrambling
* @param prevSeeds List of previously used seeds
*/
public XORUnscrambleStream(InputStream in, long seed, List<Long> prevSeeds) {
super(in);
@@ -52,8 +53,8 @@ public class XORUnscrambleStream extends FilterInputStream {
/**
* Before unscrambling, this has to be called to tell the unscrambler that scrambled data will follow.
* Before starting the unscrambler, any data will just be passed through unmodified to the underlying stream.
* The Unscrambling can be started and stopped arbitrarily at any point, allowing for parts of already unscrambled data in the stream.
* <br>Before starting the unscrambler, any data will just be passed through unmodified to the underlying stream.
* <br>The Unscrambling can be started and stopped arbitrarily at any point, allowing for parts of already unscrambled data in the stream.
*
* @throws IOException IOException
* @throws InvalidKeyException If the scrambled data could not be read, very likely caused by a wrong seed. Thrown after checking all previous seeds.
@@ -99,7 +100,7 @@ public class XORUnscrambleStream extends FilterInputStream {
/**
* Stop the unscrambling, any following data will be passed through unmodified.
* The unscrambling can be started again at any point after calling this
* <p>The unscrambling can be started again at any point after calling this
*/
public void stop() {
running = false;
@@ -126,7 +127,7 @@ public class XORUnscrambleStream extends FilterInputStream {
}
/**
* What was used to unscramble the stream, it was already unscrambled, Main Seed, Prev Seed
* What was used to unscramble the stream: it was already unscrambled | Main Seed | Prev Seed
*
* @return The Type of Seed used to unscramble this, if any
*/
@@ -180,10 +181,28 @@ public class XORUnscrambleStream extends FilterInputStream {
markRunning = running;
}
/**
* What succeeded in unscrambling the Stream.
*/
public static enum SuccessType {
/**
* The Stream was already unscrambled.
*/
UNSCRAMBLED,
/**
* The Main Seed was used to unscramble the Stream.
*/
MAIN_SEED,
/**
* One of the Previous Seeds was used to unscramble the Stream.
*/
PREV_SEED,
/**
* It was not successful.
*/
NONE;
}
}