File tree Expand file tree Collapse file tree
src/main/java/com/flowpowered/commons Expand file tree Collapse file tree Load Diff This file was deleted.
Original file line number Diff line number Diff line change 2424package com .flowpowered .commons .store ;
2525
2626import java .io .IOException ;
27+ import java .nio .charset .Charset ;
2728import java .nio .file .Files ;
2829import java .nio .file .Path ;
2930import java .util .ArrayList ;
3031import java .util .Collection ;
3132import java .util .Iterator ;
3233import java .util .Map .Entry ;
3334
34- import com .flowpowered .commons .PathUtil ;
35-
3635/**
3736 * This implements a SimpleStore that is stored in memory. The save and load methods can be used to write the map to a File.
3837 */
@@ -69,18 +68,21 @@ public synchronized boolean save() {
6968 }
7069
7170 Collection <String > strings = getStrings ();
72- boolean saved = PathUtil . stringToFile ( strings , path );
73- if ( saved ) {
71+ try {
72+ Files . write ( path , strings , Charset . defaultCharset ());
7473 dirty = false ;
74+ return true ;
75+ } catch (IOException e ) {
76+ return false ;
7577 }
76-
77- return saved ;
7878 }
7979
8080 @ Override
8181 public synchronized boolean load () {
82- Collection <String > strings = PathUtil .fileToString (path );
83- if (strings == null ) {
82+ Collection <String > strings ;
83+ try {
84+ strings = Files .readAllLines (path , Charset .defaultCharset ());
85+ } catch (IOException e ) {
8486 return false ;
8587 }
8688 boolean loaded = processStrings (strings );
You can’t perform that action at this time.
0 commit comments