File IOUtils.java
has 321 lines of code (exceeds 250 allowed). Consider refactoring. Open
/*
* ******************************************************************************
* *
* *
* * This program and the accompanying materials are made available under the
IOUtils
has 28 methods (exceeds 20 allowed). Consider refactoring. Open
public class IOUtils {
/** Cannot create a new instance of IOUtils */
private IOUtils() {}
Method fromCSVString
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
static String fromCSVString(String s) throws IOException {
if (s.charAt(0) != '\'') {
throw new IOException("Error deserializing string.");
}
int len = s.length();
- 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 fromBinaryString
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
static String fromBinaryString(final DataInput din) throws IOException {
final int utf8Len = readVInt(din);
final byte[] bytes = new byte[utf8Len];
din.readFully(bytes);
int len = 0;
Method fromCSVString
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
static String fromCSVString(String s) throws IOException {
if (s.charAt(0) != '\'') {
throw new IOException("Error deserializing string.");
}
int len = s.length();
Method toCSVString
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
static String toCSVString(String s) {
StringBuilder sb = new StringBuilder(s.length() + 1);
sb.append('\'');
int len = s.length();
for (int i = 0; i < len; i++) {
Method writeUtf8
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
private static int writeUtf8(int cpt, final byte[] bytes, final int offset) throws IOException {
if (cpt >= 0 && cpt <= 0x7F) {
bytes[offset] = (byte) cpt;
return 1;
}
Method utf8LenForCodePoint
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
private static int utf8LenForCodePoint(final int cpt) throws IOException {
if (cpt >= 0 && cpt <= 0x7F) {
return 1;
}
if (cpt >= 0x80 && cpt <= 0x07FF) {
- 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 writeUtf8
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
private static int writeUtf8(int cpt, final byte[] bytes, final int offset) throws IOException {
if (cpt >= 0 && cpt <= 0x7F) {
bytes[offset] = (byte) cpt;
return 1;
}
- 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 fromBinaryString
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
static String fromBinaryString(final DataInput din) throws IOException {
final int utf8Len = readVInt(din);
final byte[] bytes = new byte[utf8Len];
din.readFully(bytes);
int 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 toXMLString
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
static String toXMLString(String s) {
StringBuilder sb = new StringBuilder();
for (int idx = 0; idx < s.length(); idx++) {
char ch = s.charAt(idx);
if (ch == '<') {
- 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 compareBytes
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
public static int compareBytes(byte[] b1, int s1, int l1, byte[] b2, int s2, int l2) {
Method h2c
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
static private int h2c(char ch) {
if (ch >= '0' && ch <= '9') {
return ch - '0';
} else if (ch >= 'A' && ch <= 'F') {
return ch - 'A' + 10;
- 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"