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
27 public class WriteToFile {
28 protected static final Logger logger = LoggerFactory
29 .getLogger(WriteToFile.class);
30 private FileWriter fstream;
31 private BufferedWriter bufferOut;
33 public WriteToFile(String fileName) throws IOException {
34 fstream = new FileWriter(fileName);
35 bufferOut = new BufferedWriter(fstream);
38 public void save(ArrayList<String> entryList) throws IOException {
39 for (String entry : entryList) {
40 bufferOut.write(entry);
41 bufferOut.append('\n');
44 this.bufferOut.flush();
45 } catch (IOException e) {
50 public boolean close() {
54 } catch (IOException e) {