Skip to content

Commit ce12e28

Browse files
committed
0.9.0 - Remove unused WriteToFile. Update Bytes documentation. Renamed FileFilterUtil standardizePathName() -> standardSeparator() and added overload.
1 parent bba7aea commit ce12e28

9 files changed

Lines changed: 55 additions & 117 deletions

File tree

CHANGELOG.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,20 @@ This project does its best to adhere to [Semantic Versioning](http://semver.org/
44

55

66
--------
7-
### [0.8.3](N/A) - 2019-04-01
7+
### [0.9.0](N/A) - 2019-11-02
8+
#### Added
9+
* `FileFilterUtil.standardSeparator(String, char)` overload
10+
11+
#### Changed
12+
* `FileFilterUtil.standardizePathName()` -> `FileFilterUtil.standardSeparator()`
13+
* Clarified `Bytes` documentation
14+
15+
#### Removed
16+
* Unused `WriteToFile` class
17+
18+
19+
--------
20+
### [0.8.3](https://github.com/TeamworkGuy2/JFileIo/commit/bba7aeae82a99f895f9deacc5f1befaac0352b85) - 2019-04-01
821
#### Fixed
922
* Fix `FileReadUtil.decode()`, `readText()`, `readChars()`, and `readString()` overrides failing for empty streams/files
1023

bin/jfile_io-with-tests.jar

-1.53 KB
Binary file not shown.

bin/jfile_io.jar

-1.53 KB
Binary file not shown.

package-lib.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"version" : "0.8.3",
2+
"version" : "0.9.0",
33
"name" : "jfile-io",
44
"description" : "Java Helpers for File I/O: filtered FileVisitor builders, rolling file renamer, cached buffer file reader, and other File/Path helpers to make Java I/O easier",
55
"homepage" : "https://github.com/TeamworkGuy2/JFileIo",

src/twg2/io/files/Bytes.java

Lines changed: 27 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package twg2.io.files;
22

3-
/** A utility class for converting primitive types to bytes.
3+
/** A utility class for converting primitive types to/from bytes in big-endian order.
44
* For example converting an integer to 4 bytes and storing those 4 bytes
55
* at a specific location in a byte array.
66
* @author TeamworkGuy2
@@ -10,32 +10,33 @@ public final class Bytes {
1010

1111
private Bytes() { throw new AssertionError("cannot instantiate Bytes"); }
1212

13-
/** Write a double to the specified byte array as 8 bytes
13+
14+
/** Write a double to the specified byte array as 8 bytes (big-endian order)
1415
* @param value the double to write
15-
* @param b the byte array to write the long to
16+
* @param b the byte array to write the 'value' to
1617
* @param offset the offset into the array at which to write the 8 bytes
1718
*/
18-
public static final void writeDouble(double value, byte[] b, int offset) {
19+
public static void writeDouble(double value, byte[] b, int offset) {
1920
writeLong(Double.doubleToRawLongBits(value), b, offset);
2021
}
2122

2223

23-
/** Write a float to the specified byte array as 4 bytes
24+
/** Write a float to the specified byte array as 4 bytes (big-endian order)
2425
* @param value the float to write
25-
* @param b the byte array to write the float to
26+
* @param b the byte array to write the 'value' to
2627
* @param offset the offset into the array at which to write the 4 bytes
2728
*/
28-
public static final void writeFloat(float value, byte[] b, int offset) {
29+
public static void writeFloat(float value, byte[] b, int offset) {
2930
writeInt(Float.floatToRawIntBits(value), b, offset);
3031
}
3132

3233

33-
/** Write a long to the specified byte array as 8 bytes
34+
/** Write a long to the specified byte array as 8 bytes (big-endian order)
3435
* @param value the long to write
35-
* @param b the byte array to write the long to
36+
* @param b the byte array to write the 'value' to
3637
* @param offset the offset into the array at which to write the 8 bytes
3738
*/
38-
public static final void writeLong(long value, byte[] b, int offset) {
39+
public static void writeLong(long value, byte[] b, int offset) {
3940
b[offset] = (byte)(value >>> 56);
4041
b[offset+1] = (byte)(value >>> 48);
4142
b[offset+2] = (byte)(value >>> 40);
@@ -47,52 +48,52 @@ public static final void writeLong(long value, byte[] b, int offset) {
4748
}
4849

4950

50-
/** Write an int to the specified byte array as 4 bytes
51+
/** Write an int to the specified byte array as 4 bytes (big-endian order)
5152
* @param value the integer to write
52-
* @param b the byte array to write the integer to
53+
* @param b the byte array to write the 'value' to
5354
* @param offset the offset into the array at which to write the 4 bytes
5455
*/
55-
public static final void writeInt(int value, byte[] b, int offset) {
56+
public static void writeInt(int value, byte[] b, int offset) {
5657
b[offset] = (byte)(value >>> 24);
5758
b[offset+1] = (byte)(value >>> 16);
5859
b[offset+2] = (byte)(value >>> 8);
5960
b[offset+3] = (byte)(value );
6061
}
6162

6263

63-
/** Write a short to the specified byte array as 2 bytes
64+
/** Write a short to the specified byte array as 2 bytes (big-endian order)
6465
* @param value the short to write
65-
* @param b the byte array to write the short to
66+
* @param b the byte array to write the 'value' to
6667
* @param offset the offset into the array at which to write the 2 bytes
6768
*/
68-
public static final void writeShort(short value, byte[] b, int offset) {
69+
public static void writeShort(short value, byte[] b, int offset) {
6970
b[offset] = (byte)(value >>> 8);
7071
b[offset+1] = (byte)(value );
7172
}
7273

7374

74-
/** Write a boolean to the specified byte array as 1 byte (1=true, 0=false)
75+
/** Write a boolean to the specified byte array as 1 byte (1=true, 0=false) (big-endian order)
7576
* @param value the boolean to write
76-
* @param b the byte array to write the short to
77+
* @param b the byte array to write the 'value' to
7778
* @param offset the offset into the array at which to write the byte
7879
*/
79-
public static final void writeBoolean(boolean value, byte[] b, int offset) {
80+
public static void writeBoolean(boolean value, byte[] b, int offset) {
8081
b[offset] = (byte)(value ? 1 : 0);
8182
}
8283

8384

84-
/** Read a double value from the specified location in the specified array
85+
/** Read a double value from the specified location in the specified array (assumes big-endian order)
8586
* @param b the array to read the double from
8687
* @param offset the offset into the array at which to read the 8 bytes
8788
* @return eight bytes read from the indices {@code [offset, offset+3]} and
8889
* converted to a double
8990
*/
90-
public static final double readDouble(byte[] b, int offset) {
91+
public static double readDouble(byte[] b, int offset) {
9192
return Double.longBitsToDouble(readLong(b, offset));
9293
}
9394

9495

95-
/** Read a float value from the specified location in the specified array
96+
/** Read a float value from the specified location in the specified array (assumes big-endian order)
9697
* @param b the array to read the float from
9798
* @param offset the offset into the array at which to read the 4 bytes
9899
* @return four bytes read from the indices {@code [offset, offset+3]} and
@@ -103,7 +104,7 @@ public static final float readFloat(byte[] b, int offset) {
103104
}
104105

105106

106-
/** Read a long value from the specified location in the specified array
107+
/** Read a long value from the specified location in the specified array (assumes big-endian order)
107108
* @param b the array to read the long from
108109
* @param offset the offset into the array at which to read the 8 bytes
109110
* @return eight bytes read from the indices {@code [offset, offset+3]} and converted to
@@ -124,7 +125,7 @@ public static final long readLong(byte[] b, int offset) {
124125
}
125126

126127

127-
/** Read an integer value from the specified location in the specified array
128+
/** Read an integer value from the specified location in the specified array (assumes big-endian order)
128129
* @param b the array to read the integer from
129130
* @param offset the offset into the array at which to read the 4 bytes
130131
* @return four bytes read from the indices {@code [offset, offset+3]} and converted to
@@ -135,7 +136,7 @@ public static final int readInt(byte[] b, int offset) {
135136
}
136137

137138

138-
/** Read a short value from the specified location in the specified array
139+
/** Read a short value from the specified location in the specified array (assumes big-endian order)
139140
* @param b the array to read the short from
140141
* @param offset the offset into the array at which to read the 2 bytes
141142
* @return two bytes read from indices {@code offset} and {@code offset+1} and converted to
@@ -146,7 +147,7 @@ public static final short readShort(byte[] b, int offset) {
146147
}
147148

148149

149-
/** Read a boolean value from the specified location in the specified byte array (1=true, 0=false)
150+
/** Read a boolean value from the specified location in the specified byte array (1=true, 0=false) (assumes big-endian order)
150151
* @param b the array to read the boolean from
151152
* @param offset the offset into the array at which to read the byte
152153
* @return two bytes read from indices {@code offset} and {@code offset+1} and converted to

src/twg2/io/files/CharsetUtil.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public static void printCharsets() {
3737
* @param strs
3838
* @return true if the {@code strs} contained non-ASCII characters, false if all characters were ASCII
3939
*/
40-
public static final boolean checkForNonAsciiChars(String resourceName, List<String> strs) {
40+
public static boolean checkForNonAsciiChars(String resourceName, List<String> strs) {
4141
boolean res = false;
4242
for(String str : strs) {
4343
for(int i = 0, size = str.length(); i < size; i ++) {

src/twg2/io/files/FileFilterUtil.java

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,25 @@
1414
* @author TeamworkGuy2
1515
* @since 2015-9-19
1616
*/
17-
public class FileFilterUtil {
17+
public final class FileFilterUtil {
18+
19+
private FileFilterUtil() { throw new AssertionError("cannot instantiate static class FileFilterUtil"); }
1820

1921

2022
/** Replace filesystem specific separators in a string with the current {@link File#separatorChar}
2123
*/
22-
public static String standardizePathName(String path) {
24+
public static String standardSeparator(String path) {
2325
return path.replace('\\', File.separatorChar).replace('/', File.separatorChar);
2426
}
2527

2628

29+
/** Replace filesystem specific separators in a string with the 'separator'
30+
*/
31+
public static String standardSeparator(String path, char separator) {
32+
return path.replace('\\', separator).replace('/', separator);
33+
}
34+
35+
2736

2837

2938
/** A compound {@link FileFilter} that also supports tracking matches and failed matches from

src/twg2/io/files/FileUtil.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public final class FileUtil {
3535
private static final long MAX_FILE_SIZE = 1073741824;
3636

3737

38-
private FileUtil() { throw new AssertionError("cannot instantiate static class FileUtility"); }
38+
private FileUtil() { throw new AssertionError("cannot instantiate static class FileUtil"); }
3939

4040

4141
/** Overwrite the destination file with the source file

src/twg2/io/files/WriteToFile.java

Lines changed: 0 additions & 85 deletions
This file was deleted.

0 commit comments

Comments
 (0)