1
1
package com .tomclaw .cache ;
2
2
3
+ import java .io .BufferedInputStream ;
4
+ import java .io .BufferedOutputStream ;
3
5
import java .io .DataInputStream ;
4
6
import java .io .DataOutputStream ;
5
7
import java .io .File ;
@@ -105,7 +107,7 @@ private void setTotalSize(long totalSize) {
105
107
106
108
public void writeJournal () {
107
109
try (FileOutputStream fileStream = new FileOutputStream (file )) {
108
- try (DataOutputStream stream = new DataOutputStream (fileStream )) {
110
+ try (DataOutputStream stream = new DataOutputStream (new BufferedOutputStream ( fileStream ) )) {
109
111
stream .writeShort (JOURNAL_FORMAT_VERSION );
110
112
stream .writeInt (map .size ());
111
113
for (Record record : map .values ()) {
@@ -126,7 +128,7 @@ public static Journal readJournal(FileManager fileManager, Logger logger) {
126
128
logger .log ("[.] Start journal reading" , file .getName ());
127
129
Journal journal = new Journal (file , fileManager , logger );
128
130
try (FileInputStream fileStream = new FileInputStream (file )) {
129
- try (DataInputStream stream = new DataInputStream (fileStream )) {
131
+ try (DataInputStream stream = new DataInputStream (new BufferedInputStream ( fileStream ) )) {
130
132
int version = stream .readShort ();
131
133
if (version != JOURNAL_FORMAT_VERSION ) {
132
134
throw new IllegalArgumentException ("Invalid journal format version" );
0 commit comments