3 * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
5 * This program and the accompanying materials are made available under the
6 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
7 * and is available at http://www.eclipse.org/legal/epl-v10.html
10 package org.opendaylight.controller.sal.utils;
12 import java.io.BufferedWriter;
13 import java.io.FileWriter;
14 import java.io.IOException;
15 import java.util.ArrayList;
17 import org.slf4j.Logger;
18 import org.slf4j.LoggerFactory;
21 * Convenience object to write a file
26 public class WriteToFile {
27 protected static final Logger logger = LoggerFactory
28 .getLogger(WriteToFile.class);
29 private FileWriter fstream;
30 private BufferedWriter bufferOut;
32 public WriteToFile(String fileName) throws IOException {
33 fstream = new FileWriter(fileName);
34 bufferOut = new BufferedWriter(fstream);
37 public void save(ArrayList<String> entryList) throws IOException {
38 for (String entry : entryList) {
39 bufferOut.write(entry);
40 bufferOut.append('\n');
43 this.bufferOut.flush();
44 } catch (IOException e) {
49 public boolean close() {
53 } catch (IOException e) {