Skip to content

Commit 3acc8fe

Browse files
committed
Update version and add some javadoc
1 parent b86ae82 commit 3acc8fe

File tree

3 files changed

+40
-8
lines changed

3 files changed

+40
-8
lines changed

CHANGELOG

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# Releases
22

3+
## v0.4.0
4+
35
## v0.3.1
46

57
* better validation and more creation possibilities

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<groupId>at.favre.lib</groupId>
88
<artifactId>bytes</artifactId>
9-
<version>0.3.1</version>
9+
<version>0.4.0</version>
1010
<packaging>jar</packaging>
1111

1212
<name>Bytes Java Primitive Tools</name>

src/main/java/at/favre/lib/bytes/BytesValidators.java

Lines changed: 37 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,29 +33,59 @@ private BytesValidators() {
3333
* Checks the length of a byte array
3434
*
3535
* @param byteLength to check against
36-
* @return true if longer than given value
36+
* @return true if longer or equal to given value
3737
*/
3838
public static BytesValidator atLeast(int byteLength) {
3939
return new BytesValidator.Length(byteLength, BytesValidator.Length.Mode.GREATER_OR_EQ_THAN);
4040
}
4141

42+
/**
43+
* Checks the length of a byte array
44+
*
45+
* @param byteLength to check against
46+
* @return true if smaller or equal to given value
47+
*/
4248
public static BytesValidator atMost(int byteLength) {
4349
return new BytesValidator.Length(byteLength, BytesValidator.Length.Mode.SMALLER_OR_EQ_THAN);
4450
}
4551

52+
/**
53+
* Checks the length of a byte array
54+
*
55+
* @param byteLength to check against
56+
* @return true if equal to given value
57+
*/
4658
public static BytesValidator exactLength(int byteLength) {
4759
return new BytesValidator.Length(byteLength, BytesValidator.Length.Mode.EXACT);
4860
}
4961

50-
public static BytesValidator onlyOf(byte value) {
51-
return new BytesValidator.IdenticalContent(value, BytesValidator.IdenticalContent.Mode.ONLY_OF);
62+
/**
63+
* Checks individual byte content
64+
*
65+
* @param refByte to check against
66+
* @return true if array only consists of refByte
67+
*/
68+
public static BytesValidator onlyOf(byte refByte) {
69+
return new BytesValidator.IdenticalContent(refByte, BytesValidator.IdenticalContent.Mode.ONLY_OF);
5270
}
5371

54-
public static BytesValidator notOnlyOf(byte value) {
55-
return new BytesValidator.IdenticalContent(value, BytesValidator.IdenticalContent.Mode.NOT_ONLY_OF);
72+
/**
73+
* Checks individual byte content
74+
*
75+
* @param refByte to check against
76+
* @return true if array has at least one byte that is not refByte
77+
*/
78+
public static BytesValidator notOnlyOf(byte refByte) {
79+
return new BytesValidator.IdenticalContent(refByte, BytesValidator.IdenticalContent.Mode.NOT_ONLY_OF);
5680
}
5781

58-
public static BytesValidator noneOf(byte value) {
59-
return new BytesValidator.IdenticalContent(value, BytesValidator.IdenticalContent.Mode.NONE_OF);
82+
/**
83+
* Checks individual byte content
84+
*
85+
* @param refByte to check against
86+
* @return true if array has no value refByte
87+
*/
88+
public static BytesValidator noneOf(byte refByte) {
89+
return new BytesValidator.IdenticalContent(refByte, BytesValidator.IdenticalContent.Mode.NONE_OF);
6090
}
6191
}

0 commit comments

Comments
 (0)