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;
13 import java.util.ArrayList;
15 import org.slf4j.Logger;
16 import org.slf4j.LoggerFactory;
19 * Convenience object to write a file
24 public class WriteToFile {
25 protected static final Logger logger = LoggerFactory
26 .getLogger(WriteToFile.class);
27 private FileWriter fstream;
28 private BufferedWriter bufferOut;
30 public WriteToFile(String fileName) throws IOException {
31 fstream = new FileWriter(fileName);
32 bufferOut = new BufferedWriter(fstream);
35 public void save(ArrayList<String> entryList) throws IOException {
36 for (String entry : entryList) {
37 bufferOut.write(entry);
38 bufferOut.append('\n');
41 this.bufferOut.flush();
42 } catch (IOException e) {
47 public boolean close() {
51 } catch (IOException e) {