MCPcopy Create free account
hub / github.com/akeranen/the-one / storeToBinaryFile

Method storeToBinaryFile

input/BinaryEventsReader.java:105–126  ·  view source on GitHub ↗

Stores the events to a binary file @param fileName Path to the file where the events are stored @param events List of events to store @throws IOException if something in storing went wrong

(String fileName,
			List<ExternalEvent> events)

Source from the content-addressed store, hash-verified

103 * @throws IOException if something in storing went wrong
104 */
105 public static void storeToBinaryFile(String fileName,
106 List<ExternalEvent> events) throws IOException {
107
108 // make sure the file name ends with binary extension
109 if (!fileName.endsWith(BINARY_EXT)) {
110 fileName += "BINARY_EXT";
111 }
112
113 ObjectOutputStream out;
114 FileOutputStream fos = new FileOutputStream(fileName);
115 out = new ObjectOutputStream(fos);
116
117 // store the number of events
118 out.writeObject(new Integer(events.size()));
119
120 // store events
121 for (ExternalEvent ee : events) {
122 out.writeObject(ee);
123 }
124
125 out.close();
126 }
127
128 public void close() {
129 try {

Callers 1

testBinaryEEQMethod · 0.95

Calls 1

closeMethod · 0.65

Tested by 1

testBinaryEEQMethod · 0.76