-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reducing duplicate code in MRJAR using VersionSpecifics class
Signed-off-by: Markus KARG <markus@headcrashing.eu>
- Loading branch information
Showing
7 changed files
with
100 additions
and
1,774 deletions.
There are no files selected for viewing
29 changes: 29 additions & 0 deletions
29
src/main/java/org/codehaus/plexus/util/CommonImplementation.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package org.codehaus.plexus.util; | ||
|
||
import java.io.IOException; | ||
import java.io.InputStream; | ||
import java.io.OutputStream; | ||
import java.io.Reader; | ||
import java.io.Writer; | ||
|
||
/** | ||
* Fallback implementation for all Java SE versions not | ||
* overwriting a method version-specifically. | ||
*/ | ||
abstract class CommonImplementation | ||
{ | ||
private static final int DEFAULT_BUFFER_SIZE = 1024 * 16; | ||
|
||
void copy( final InputStream input, final OutputStream output ) | ||
throws IOException | ||
{ | ||
IOUtil.copy( input, output, DEFAULT_BUFFER_SIZE ); | ||
} | ||
|
||
void copy( final Reader input, final Writer output ) | ||
throws IOException | ||
{ | ||
IOUtil.copy( input, output, DEFAULT_BUFFER_SIZE ); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
src/main/java/org/codehaus/plexus/util/VersionSpecifics.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package org.codehaus.plexus.util; | ||
|
||
/** | ||
* Implementation specific to Java SE 8 version. | ||
*/ | ||
final class VersionSpecifics extends CommonImplementation | ||
{ | ||
static final VersionSpecifics INSTANCE = new VersionSpecifics(); | ||
|
||
private VersionSpecifics() { | ||
// singleton | ||
} | ||
} |
Oops, something went wrong.