Skip to content

Commit d5ac1f7

Browse files
authored
BinaryExporter: log messages
1 parent 670bf02 commit d5ac1f7

File tree

1 file changed

+14
-16
lines changed

1 file changed

+14
-16
lines changed

jme3-core/src/plugins/java/com/jme3/export/binary/BinaryExporter.java

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,6 @@ public static BinaryExporter getInstance() {
155155

156156
/**
157157
* Saves the object into memory then loads it from memory.
158-
*
159158
* Used by tests to check if the persistence system is working.
160159
*
161160
* @param <T> The type of savable.
@@ -207,14 +206,13 @@ public void save(Savable object, OutputStream os) throws IOException {
207206
BinaryClassObject bco = classes.get(key);
208207

209208
// write alias
210-
byte[] aliasBytes = fixClassAlias(bco.alias,
211-
aliasSize);
209+
byte[] aliasBytes = fixClassAlias(bco.alias, aliasSize);
212210
os.write(aliasBytes); // 4. "class alias"
213211
classTableSize += aliasSize;
214212

215213
// jME3 NEW: Write class hierarchy version numbers
216-
os.write( bco.classHierarchyVersions.length );
217-
for (int version : bco.classHierarchyVersions){
214+
os.write(bco.classHierarchyVersions.length);
215+
for (int version : bco.classHierarchyVersions) {
218216
os.write(ByteUtils.convertToBytes(version));
219217
}
220218
classTableSize += 1 + bco.classHierarchyVersions.length * 4;
@@ -243,14 +241,12 @@ public void save(Savable object, OutputStream os) throws IOException {
243241
// write out data to a separate stream
244242
int location = 0;
245243
// keep track of location for each piece
246-
HashMap<String, ArrayList<BinaryIdContentPair>> alreadySaved = new HashMap<>(
247-
contentTable.size());
244+
HashMap<String, ArrayList<BinaryIdContentPair>> alreadySaved = new HashMap<>(contentTable.size());
248245
for (Savable savable : contentKeys) {
249246
// look back at previous written data for matches
250247
String savableName = savable.getClass().getName();
251248
BinaryIdContentPair pair = contentTable.get(savable);
252-
ArrayList<BinaryIdContentPair> bucket = alreadySaved
253-
.get(savableName + getChunk(pair));
249+
ArrayList<BinaryIdContentPair> bucket = alreadySaved.get(savableName + getChunk(pair));
254250
int prevLoc = findPrevMatch(pair, bucket);
255251
if (prevLoc != -1) {
256252
locationTable.put(pair.getId(), prevLoc);
@@ -294,12 +290,13 @@ public void save(Savable object, OutputStream os) throws IOException {
294290
out.writeTo(os);
295291

296292
if (debug) {
297-
logger.log(Level.INFO, "BinaryExporter Stats:");
298-
logger.log(Level.INFO, "classes: {0}", classNum);
299-
logger.log(Level.INFO, "class table: {0} bytes", classTableSize);
300-
logger.log(Level.INFO, "objects: {0}", numLocations);
301-
logger.log(Level.INFO, "location table: {0} bytes", locationTableSize);
302-
logger.log(Level.INFO, "data: {0} bytes", location);
293+
logger.log(Level.INFO, "BinaryExporter Stats:"
294+
+ "\n * Classes: {0}"
295+
+ "\n * Class Table: {1} bytes"
296+
+ "\n * Objects: {2}"
297+
+ "\n * Location Table: {3} bytes"
298+
+ "\n * Data: {4} bytes",
299+
new Object[] {classNum, classTableSize, numLocations, locationTableSize, location});
303300
}
304301
}
305302

@@ -309,8 +306,9 @@ private String getChunk(BinaryIdContentPair pair) {
309306
}
310307

311308
private int findPrevMatch(BinaryIdContentPair oldPair, ArrayList<BinaryIdContentPair> bucket) {
312-
if (bucket == null)
309+
if (bucket == null) {
313310
return -1;
311+
}
314312
for (int x = bucket.size(); --x >= 0;) {
315313
BinaryIdContentPair pair = bucket.get(x);
316314
if (pair.getContent().equals(oldPair.getContent())) {

0 commit comments

Comments
 (0)