Skip to content

Commit 58cd72d

Browse files
committed
0.8.2 - refactor FileReadUtil with more optimized code and InputStream -> char[]/String methods, better FileReadUtil chunkSize and charset defaults customization via constructor and static defaults for thread local instances, more unit tests
1 parent 73c98e3 commit 58cd72d

File tree

11 files changed

+577
-136
lines changed

11 files changed

+577
-136
lines changed

.classpath

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
1-
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
1+
<?xml version="1.0" encoding="UTF-8"?>
22
<classpath>
33
<classpathentry kind="src" path="src"/>
44
<classpathentry kind="src" path="test"/>
5-
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/jre-9.0.1">
5+
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER">
66
<attributes>
77
<attribute name="module" value="true"/>
88
</attributes>
99
</classpathentry>
1010
<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/5"/>
1111
<classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/TestChecks"/>
12-
<classpathentry kind="output" path="bin"/>
1312
<classpathentry kind="lib" path="C:/Users/TeamworkGuy2/Documents/Java/Libraries/jarrays/bin/jarrays.jar" sourcepath="/JArrays"/>
1413
<classpathentry kind="lib" path="C:/Users/TeamworkGuy2/Documents/Java/Libraries/jcollection-interfaces/bin/jcollection_interfaces.jar" sourcepath="/JCollectionInterfaces"/>
1514
<classpathentry kind="lib" path="C:/Users/TeamworkGuy2/Documents/Java/Libraries/jcollection-util/bin/jcollection_util.jar" sourcepath="/JCollectionUtil"/>
@@ -19,4 +18,5 @@
1918
<classpathentry kind="lib" path="C:/Users/TeamworkGuy2/Documents/Java/Libraries/jtext-template/bin/jtext_template.jar" sourcepath="/JTextTemplate"/>
2019
<classpathentry kind="lib" path="C:/Users/TeamworkGuy2/Documents/Java/Libraries/jtext-util/bin/jtext_util.jar" sourcepath="/JTextUtil"/>
2120
<classpathentry kind="lib" path="C:/Users/TeamworkGuy2/Documents/Java/Libraries/jtwg2-logging/bin/jtwg2_logging.jar" sourcepath="/JTwg2Logging"/>
21+
<classpathentry kind="output" path="bin"/>
2222
</classpath>

CHANGELOG.md

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

55

66
--------
7-
### [0.8.1](N/A) - 2017-12-30
7+
### [0.8.2](N/A) - 2019-03-30
8+
#### Changed
9+
* Rewrite `FileReadUtil`:
10+
* Less array allocations
11+
* Text decoding methods from `InputStream` -> `char[]` or `String` with optimized direct `CharsetDecoder.decode()` calls
12+
* More helper methods for `File`, `InputStream`, and overloads with default `chunkSize` and `charsetDecoder` overrides
13+
* Static default `ChunkSize` and `charsetDecoder` fields with setters to allow the `threadLocalInst()` constructor defaults to be set
14+
* Bug fixes and better unit testing with `LimitedByteArrayInputStream` to replicate input stream `read()` calls that only return partial and require subseqent calls
15+
16+
17+
--------
18+
### [0.8.1](https://github.com/TeamworkGuy2/JFileIo/commit/73c98e3414a598f3faa979da2d0abcad2316627c) - 2017-12-30
819
#### Changed
920
* Upgrade to Java 9
1021
* Upgrade to JUnit 5
@@ -120,7 +131,7 @@ This project does its best to adhere to [Semantic Versioning](http://semver.org/
120131
--------
121132
### [0.4.0](https://github.com/TeamworkGuy2/JFileIo/commit/65a89848376862c2fc3ce12e1e8e011e8166ae9f) - 2016-02-24
122133
#### Changed
123-
* Move twg2.io.log package to separate [JTwg2Logging] (https://github.com/TeamworkGuy2/JTwg2Logging) library
134+
* Move twg2.io.log package to separate [JTwg2Logging](https://github.com/TeamworkGuy2/JTwg2Logging) library
124135

125136

126137
--------
@@ -130,7 +141,7 @@ This project does its best to adhere to [Semantic Versioning](http://semver.org/
130141
* Updated FileReadUtil to only use thread local caches to prevent bugs when calling these static methods from multiple threads
131142

132143
#### Removed
133-
* Removed some unused CharsetUtil methods
144+
* Removed some unused CharsetUtil methods
134145

135146

136147
--------

README.md

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,22 @@
11
JFileIo
22
==============
3-
version: 0.8.1
43

54
Utilities for reading/writing data from/to files in Java. Includes:
65
* Builders and utility methods for external process execution (i.e. runtime.exec(...))
76
* Filtered FileVisitor builders which can be passed to Files.walkFileTree(...)
87
* Rolling file renamer for creating log files or file snapshots/backups
9-
* File reader utility class for reading files using interal cache which is reused between file reads with smart buffer resizing to minimize garbage generated
8+
* File reader utility class for reading files using internal cache which is reused between file reads with smart buffer resizing to minimize garbage generated
109

11-
Take a look at the 'twg2.io.test' package for some examples of how the API can be used.
10+
Take a look at the `twg2.io.test` package for some examples of how the API can be used.
11+
12+
13+
--------
14+
## Reusable Buffered File Reading
15+
16+
Reuses internal buffers to allow for nearly allocation free file loading on subsequent files read:
17+
```Java
18+
String text = FileReadUtil.threadLocalInst().readString(new File(...));
19+
```
1220

1321

1422
--------

bin/jfile_io-with-tests.jar

4.9 KB
Binary file not shown.

bin/jfile_io.jar

2.95 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.1",
2+
"version" : "0.8.2",
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",

0 commit comments

Comments
 (0)