List of usage examples for org.apache.commons.lang3 SerializationUtils serialize
public static void serialize(final Serializable obj, final OutputStream outputStream)
Serializes an Object to the specified stream.
The stream will be closed once the object is written.
From source file:net.spfbl.core.User.java
public synchronized static void store() { if (CHANGED) { try {//w w w . j a v a 2 s . c o m storeDB(); // Server.logTrace("storing user.map"); long time = System.currentTimeMillis(); HashMap<String, User> map = getMap(); File file = new File("./data/user.map"); FileOutputStream outputStream = new FileOutputStream(file); try { SerializationUtils.serialize(map, outputStream); // Atualiza flag de atualizao. CHANGED = false; } finally { outputStream.close(); } Server.logStore(time, file); } catch (Exception ex) { Server.logError(ex); } } }
From source file:net.spfbl.data.Block.java
public static void store(boolean simplify) { if (CHANGED) { if (simplify) { Server.logTrace("simplifing block.set"); CIDR.simplify();/*from ww w. j ava 2 s .c om*/ } try { // Server.logTrace("storing block.set"); long time = System.currentTimeMillis(); File file = new File("./data/block.set"); TreeSet<String> tokenSet = getAll(); FileOutputStream outputStream = new FileOutputStream(file); try { SerializationUtils.serialize(tokenSet, outputStream); CHANGED = false; } finally { outputStream.close(); } Server.logStore(time, file); } catch (Exception ex) { Server.logError(ex); } try { // Server.logTrace("storing block.map"); long time = System.currentTimeMillis(); File file = new File("./data/block.map"); TreeMap<String, Long> tokenMap = SET.getMap(); FileOutputStream outputStream = new FileOutputStream(file); try { SerializationUtils.serialize(tokenMap, outputStream); CHANGED = false; } finally { outputStream.close(); } Server.logStore(time, file); } catch (Exception ex) { Server.logError(ex); } } }
From source file:net.spfbl.data.Generic.java
public static void store() { if (CHANGED) { try {//from w w w. j a v a 2 s . co m // Server.logTrace("storing generic.set"); long time = System.currentTimeMillis(); File file = new File("./data/generic.set"); TreeSet<String> set = getGenericAll(); FileOutputStream outputStream = new FileOutputStream(file); try { SerializationUtils.serialize(set, outputStream); CHANGED = false; } finally { outputStream.close(); } Server.logStore(time, file); // Server.logTrace("storing generic.map"); time = System.currentTimeMillis(); file = new File("./data/generic.map"); TreeMap<String, Boolean> map = getMapAll(); outputStream = new FileOutputStream(file); try { SerializationUtils.serialize(map, outputStream); CHANGED = false; } finally { outputStream.close(); } Server.logStore(time, file); } catch (Exception ex) { Server.logError(ex); } } }
From source file:net.spfbl.data.Ignore.java
public static void store() { if (CHANGED) { try {/*from w ww. j a v a 2s . c o m*/ // Server.logTrace("storing ignore.set"); long time = System.currentTimeMillis(); File file = new File("./data/ignore.set"); TreeSet<String> set = getAll(); FileOutputStream outputStream = new FileOutputStream(file); try { SerializationUtils.serialize(set, outputStream); CHANGED = false; } finally { outputStream.close(); } Server.logStore(time, file); } catch (Exception ex) { Server.logError(ex); } } }
From source file:net.spfbl.data.NoReply.java
public static void store() { if (CHANGED) { try {/* w w w . j av a2s. c om*/ // Server.logTrace("storing noreply.set"); long time = System.currentTimeMillis(); File file = new File("./data/noreply.set"); TreeSet<String> set = getAll(); FileOutputStream outputStream = new FileOutputStream(file); try { SerializationUtils.serialize(set, outputStream); CHANGED = false; } finally { outputStream.close(); } Server.logStore(time, file); } catch (Exception ex) { Server.logError(ex); } } }
From source file:net.spfbl.data.Provider.java
public static void store() { if (CHANGED) { try {// w w w . j a v a2s . com // Server.logTrace("storing provider.set"); long time = System.currentTimeMillis(); File file = new File("./data/provider.set"); TreeSet<String> set = getAll(); FileOutputStream outputStream = new FileOutputStream(file); try { SerializationUtils.serialize(set, outputStream); CHANGED = false; } finally { outputStream.close(); } Server.logStore(time, file); } catch (Exception ex) { Server.logError(ex); } } }
From source file:net.spfbl.data.Trap.java
public static void store() { if (CHANGED) { try {//from ww w .j a v a 2 s.c o m // Server.logTrace("storing trap.map"); long time = System.currentTimeMillis(); File file = new File("./data/trap.map"); HashMap<String, Long> map = getMap(); FileOutputStream outputStream = new FileOutputStream(file); try { SerializationUtils.serialize(map, outputStream); CHANGED = false; } finally { outputStream.close(); } Server.logStore(time, file); } catch (Exception ex) { Server.logError(ex); } } }
From source file:net.spfbl.data.White.java
public static void store(boolean simplify) { if (CHANGED) { try {/* ww w . jav a 2 s . c om*/ if (simplify) { Server.logTrace("simplifing white.set"); CIDR.simplify(); } // Server.logTrace("storing white.set"); long time = System.currentTimeMillis(); File file = new File("./data/white.set"); TreeSet<String> set = getAll(); FileOutputStream outputStream = new FileOutputStream(file); try { SerializationUtils.serialize(set, outputStream); CHANGED = false; } finally { outputStream.close(); } Server.logStore(time, file); } catch (Exception ex) { Server.logError(ex); } } }
From source file:net.spfbl.dns.QueryDNS.java
public static void store() { if (CHANGED) { try {//from ww w. ja va 2 s .co m // Server.logTrace("storing zone.map"); long time = System.currentTimeMillis(); File file = new File("./data/zone.map"); HashMap<String, Zone> map = getMap(); FileOutputStream outputStream = new FileOutputStream(file); try { SerializationUtils.serialize(map, outputStream); CHANGED = false; } finally { outputStream.close(); } Server.logStore(time, file); } catch (Exception ex) { Server.logError(ex); } } }
From source file:net.spfbl.dnsbl.QueryDNSBL.java
public static void store() { if (CHANGED) { try {/* ww w . j a v a2 s .c o m*/ long time = System.currentTimeMillis(); File file = new File("./data/dnsbl.map"); HashMap<String, ServerDNSBL> map = getMap(); FileOutputStream outputStream = new FileOutputStream(file); try { SerializationUtils.serialize(map, outputStream); CHANGED = false; } finally { outputStream.close(); } Server.logStore(time, file); } catch (Exception ex) { Server.logError(ex); } } }