File FileBuffer.java
has 519 lines of code (exceeds 250 allowed). Consider refactoring. Open
package de.uniks.networkparser.ext.io;
/*
NetworkParser
The MIT License
FileBuffer
has 40 methods (exceeds 20 allowed). Consider refactoring. Open
public class FileBuffer extends Buffer {
public static final int BUFFER = 4096;
private BufferedReader reader;
private File file;
private CharacterBuffer lookAHead = new CharacterBuffer();
Method parsingBuffer
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
private static BaseItem parsingBuffer(CharacterBuffer buffer, BaseItem container) {
if (buffer != null && buffer.length() > 0) {
char startCharacter = buffer.nextClean(true);
if (startCharacter == '{') {
JsonObject result;
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method parsingBuffer
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
private static BaseItem parsingBuffer(CharacterBuffer buffer, BaseItem container) {
if (buffer != null && buffer.length() > 0) {
char startCharacter = buffer.nextClean(true);
if (startCharacter == '{') {
JsonObject result;
Method writeFile
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
public static final int writeFile(String fileName, byte[] data, byte flag) {
if (fileName == null || fileName.length() < 1) {
return -1;
}
if (data == null || data.length < 1 || (data.length == 1 && data[0] == 0)) {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method readBinaryResource
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public static ByteBuffer readBinaryResource(String file) {
if (file == null) {
return null;
}
InputStream is = IdMap.class.getResourceAsStream(file);
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method readFile
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public static final CharacterBuffer readFile(File file) {
CharacterBuffer sb = new CharacterBuffer();
if (file == null) {
return sb;
}
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method readBinaryFile
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public static final ByteBuffer readBinaryFile(String file) {
if (file == null) {
return null;
}
File content = new File(file);
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method readResource
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public static CharacterBuffer readResource(InputStream is) {
CharacterBuffer sb = new CharacterBuffer();
if (is != null) {
final byte[] buffer = new byte[BUFFER];
try {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method readBinaryFile
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static final ByteBuffer readBinaryFile(String file) {
if (file == null) {
return null;
}
File content = new File(file);
Method skip
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public static long skip(InputStream input, long numToSkip) {
if (input == null) {
return -1;
}
long available = numToSkip;
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method write
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public int write(byte flag, byte... data) {
if (this.file == null || data == null) {
return -1;
}
if (data.length == 1 && data[0] == 0) {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method getChar
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
@Override
public char getChar() {
char value = 0;
if (this.reader == null) {
return value;
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Avoid too many return
statements within this method. Open
return container;
Avoid too many return
statements within this method. Open
return false;
Avoid too many return
statements within this method. Open
return buffer.write(flag, data);
Avoid too many return
statements within this method. Open
return -1;
Method toString
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
@Override
public String toString() {
char[] values = new char[remaining()];
int len = lookAHead.length();
if (len > 0) {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method readFully
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public static int readFully(final InputStream input, final byte[] b, final int offset, final int len) {
if (b == null || input == null || len < 0 || offset < 0 || len + offset > b.length) {
return -1;
}
int count = 0, x = 0;
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"