Skip to content

Commit

Permalink
formatted, javadoc, sort members and organize imports
Browse files Browse the repository at this point in the history
unit tests extended
  • Loading branch information
astrapi69 committed Apr 27, 2019
1 parent 2f735e5 commit e727191
Show file tree
Hide file tree
Showing 20 changed files with 259 additions and 130 deletions.
40 changes: 20 additions & 20 deletions src/main/java/de/alpharogroup/io/SerializedObjectExtensions.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
import lombok.experimental.UtilityClass;

/**
* Helper-class for read from and write to serialized objects.
* Helper-class for read from and write to serialized objects
*
* @version 1.0
* @author Asterios Raptis
Expand All @@ -46,16 +46,16 @@ public final class SerializedObjectExtensions
{

/**
* Reads the object from the given file.
* Reads the object from the given file
*
* @param file
* In that file is the object saved.
* @return The object in the file or null.
* In that file is the object saved
* @return The object in the file or null
* @throws IOException
* Signals that an I/O exception has occurred.
* Signals that an I/O exception has occurred
* @throws ClassNotFoundException
* is thrown when a class is not found in the classloader or no definition for the
* class with the specified name could be found.
* class with the specified name could be found
*/
public static Object readSerializedObjectFromFile(final File file)
throws IOException, ClassNotFoundException
Expand All @@ -71,15 +71,15 @@ public static Object readSerializedObjectFromFile(final File file)
}

/**
* The Method toByteArray() serialize an Object to byte array.
* The Method toByteArray() serialize an Object to byte array
*
* @param <T>
* the generic type of the given object
* @param object
* The Object to convert into a byte array.
* @return The byte array from the Object.
* The Object to convert into a byte array
* @return The byte array from the Object
* @throws IOException
* Signals that an I/O exception has occurred.
* Signals that an I/O exception has occurred
*/
public static <T> byte[] toByteArray(final T object) throws IOException
{
Expand All @@ -92,16 +92,16 @@ public static <T> byte[] toByteArray(final T object) throws IOException
}

/**
* The Method toObject() converts the given byte array into an Object.
* The Method toObject() converts the given byte array into an Object
*
* @param byteArray
* The byte array to convert into an Object.
* @return The Object the was converted from the byte array.
* The byte array to convert into an Object
* @return The Object the was converted from the byte array
* @throws IOException
* Signals that an I/O exception has occurred.
* Signals that an I/O exception has occurred
* @throws ClassNotFoundException
* is thrown when a class is not found in the classloader or no definition for the
* class with the specified name could be found.
* class with the specified name could be found
*/
public static Object toObject(final byte[] byteArray) throws IOException, ClassNotFoundException
{
Expand All @@ -116,15 +116,15 @@ public static Object toObject(final byte[] byteArray) throws IOException, ClassN
}

/**
* Writes the given object to the given File.
* Writes the given object to the given File
*
* @param obj
* The object to write to the File.
* The object to write to the File
* @param file
* In this file will be the object saved.
* @return true if the object was written to the file otherwise false.
* In this file will be the object saved
* @return true if the object was written to the file otherwise false
* @throws IOException
* Signals that an I/O exception has occurred.
* Signals that an I/O exception has occurred
*/
public static boolean writeSerializedObjectToFile(final Object obj, final File file)
throws IOException
Expand Down
20 changes: 10 additions & 10 deletions src/main/java/de/alpharogroup/io/StreamExtensions.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
import lombok.experimental.UtilityClass;

/**
* Utility class for input/output operations.
* Utility class for input/output operations
*
* @version 1.0
* @author Asterios Raptis
Expand All @@ -55,34 +55,34 @@ public final class StreamExtensions implements Serializable
{

/**
* The serialVersionUID.
* The serialVersionUID
*/
private static final long serialVersionUID = 5042445056004440533L;

/**
* Returns the given InputStream as a byte array.
* Returns the given InputStream as a byte array
*
* @param in
* The InputStream.
* @return Returns the given InputStream as a byte array.
* The InputStream
* @return Returns the given InputStream as a byte array
* @throws IOException
* Signals that an I/O exception has occurred.
* Signals that an I/O exception has occurred
*/
public static byte[] getByteArray(final InputStream in) throws IOException
{
return getByteArray(in, new ByteArrayOutputStream(in.available()));
}

/**
* Gets the byte array.
* Gets the byte array
*
* @param in
* The InputStream.
* The InputStream
* @param os
* The ByteArrayOutputStream.
* The ByteArrayOutputStream
* @return the byte array
* @throws IOException
* Signals that an I/O exception has occurred.
* Signals that an I/O exception has occurred
*/
public static byte[] getByteArray(final InputStream in, final ByteArrayOutputStream os)
throws IOException
Expand Down
14 changes: 7 additions & 7 deletions src/main/java/de/alpharogroup/io/annotations/ImportResource.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,23 +30,23 @@
import java.lang.annotation.Target;

/**
* The annotation {@link ImportResource} can be used to import a resource.
* The annotation {@link ImportResource} can be used to import a resource
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
public @interface ImportResource {

/**
* The index from the resource.
* The index from the resource
*
* @return the index from the resource.
* @return the index from the resource
*/
int index() default 0;

/**
* The resource name.
* The resource name
*
* @return the resource name.
* @return the resource name
*/
String resourceName();

Expand All @@ -58,9 +58,9 @@
String resourceType();

/**
* The "skin" style of the resource.
* The "skin" style of the resource
*
* @return The "skin" style of the resource.
* @return The "skin" style of the resource
*/
String style() default "";
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,16 @@
import java.lang.annotation.Target;

/**
* The annotation {@link ImportResources} contains an Array of {@link ImportResource} objects.
* The annotation {@link ImportResources} contains an Array of {@link ImportResource} objects
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
public @interface ImportResources {

/**
* The array of {@link ImportResource} objects.
* The array of {@link ImportResource} objects
*
* @return the array of {@link ImportResource} objects.
* @return the array of {@link ImportResource} objects
*/
ImportResource[] resources();
}
8 changes: 4 additions & 4 deletions src/main/java/de/alpharogroup/io/file/FileConstants.java
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package de.alpharogroup.io.file;

/**
* Constant Class for files.
* The class {@link FileConstants} is an abstract constant for files
*
* @version 1.0
* @author Asterios Raptis
* @version 1.0
*/
public abstract class FileConstants
{
Expand All @@ -22,7 +22,7 @@ public abstract class FileConstants
public static final String DOUBLEDOT = ":";

/**
* String array with the invalid characters in filenames.
* String array with the invalid characters in filenames
*/
public static String[] INVALID_CHARS_IN_FILENAME = { "\\", "/", ":", "*", "\"", "<", ">", "|" };

Expand All @@ -33,7 +33,7 @@ public abstract class FileConstants
public static final String SLASH = "/";

/**
* String array with a few extensions from zip-files.
* String array with a few extensions from zip-files
*/
public static final String[] ZIP_EXTENSIONS = { ".zip", ".jar", ".war", ".ear", ".tar", ".rar",
".7z", ".bz2", ".gz" };
Expand Down
20 changes: 10 additions & 10 deletions src/main/java/de/alpharogroup/io/file/FileExtension.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,36 +27,36 @@
import lombok.Getter;

/**
* The enum {@link FileExtension} for file extensions.
* The enum {@link FileExtension} for file extensions
*/
public enum FileExtension
{

/** The file extension for backup files. */
/** The file extension for backup files */
BACKUP(".bak"),

/** The file extension for class files. */
/** The file extension for class files */
CLASS(".class"),

/** The file extension for decrypted files. */
/** The file extension for decrypted files */
DECRYPTED(".decrypted"),

/** The file extension for encrypted files. */
/** The file extension for encrypted files */
ENCRYPTED(".enc"),

/** The file extension for java files. */
/** The file extension for java files */
JAVA(".java"),

/** The file extension for properties files. */
/** The file extension for properties files */
PROPERTIES(".properties"),

/** The file extension for txt files. */
/** The file extension for txt files */
TXT(".txt"),

/** The file extension for velocity template files. */
/** The file extension for velocity template files */
VELOCITY_TEMPLATE(".vm");

/** The file extension. */
/** The file extension */
@Getter
private final String extension;

Expand Down
26 changes: 13 additions & 13 deletions src/main/java/de/alpharogroup/io/file/FilenameExtensions.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@
import lombok.experimental.UtilityClass;

/**
* The class {@link FilenameExtensions}.
* The class {@link FilenameExtensions}
*/
@UtilityClass
public final class FilenameExtensions
{

/**
* Gets the filename with the absolute path prefix.
* Gets the filename with the absolute path prefix
*
* @param file
* the file.
* @return the filename prefix.
* the file
* @return the filename prefix
*/
public static String getFilenamePrefix(final File file)
{
Expand All @@ -35,12 +35,12 @@ public static String getFilenamePrefix(final File file)
}

/**
* Gets the filename suffix or null if no suffix exists or the given file object is a directory.
* Gets the filename suffix or null if no suffix exists or the given file object is a directory
*
* @param file
* the file.
* the file
* @return 's the filename suffix or null if no suffix exists or the given file object is a
* directory.
* directory
*/
public static String getFilenameSuffix(final File file)
{
Expand All @@ -63,11 +63,11 @@ public static String getFilenameSuffix(final File file)
}

/**
* Gets the filename without the extension or null if the given file object is a directory.
* Gets the filename without the extension or null if the given file object is a directory
*
* @param file
* the file.
* @return the filename without the extension or null if the given file object is a directory.
* the file
* @return the filename without the extension or null if the given file object is a directory
*/
public static String getFilenameWithoutExtension(final File file)
{
Expand All @@ -80,11 +80,11 @@ public static String getFilenameWithoutExtension(final File file)
}

/**
* Gets the filename without the extension or null if the given file object is a directory.
* Gets the filename without the extension or null if the given file object is a directory
*
* @param fileName
* the file.
* @return the filename without the extension or null if the given file object is a directory.
* the file
* @return the filename without the extension or null if the given file object is a directory
*/
public static String getFilenameWithoutExtension(final String fileName)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

/**
* The class ClassFileFilter accepts File-objects that are directories or end with the suffix
* '.class'. Accepts directories to allow search files recursive in directories.
* '.class'. Accepts directories to allow search files recursive in directories
*
* @version 1.0
* @author Asterios Raptis
Expand Down
Loading

0 comments on commit e727191

Please sign in to comment.