X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fsal%2Fapi%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fsal%2Futils%2FObjectWriter.java;fp=opendaylight%2Fsal%2Fapi%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fsal%2Futils%2FObjectWriter.java;h=0000000000000000000000000000000000000000;hb=42c32160bfd41de57189bb246fec5ffb48ed8e9e;hp=8e1dcd69f999fec5f2619c1f8e65d0fc511212f4;hpb=edf5bfcee83c750853253ccfd991ba7000f5f65b;p=controller.git diff --git a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/utils/ObjectWriter.java b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/utils/ObjectWriter.java deleted file mode 100644 index 8e1dcd69f9..0000000000 --- a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/utils/ObjectWriter.java +++ /dev/null @@ -1,66 +0,0 @@ - -/* - * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ - -package org.opendaylight.controller.sal.utils; - -import java.io.FileNotFoundException; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.ObjectOutputStream; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * Write object to write to file stream - * - */ -public class ObjectWriter { - private static Logger logger = LoggerFactory.getLogger(ObjectWriter.class); - private FileOutputStream fos; - private ObjectOutputStream oos; - - public ObjectWriter() { - fos = null; - oos = null; - } - - public Status write(Object obj, String file) { - try { - fos = new FileOutputStream(file); - oos = new ObjectOutputStream(fos); - oos.writeObject(obj); - } catch (FileNotFoundException fex) { - logger.error("Cannot create {} for writing", file); - return new Status(StatusCode.INTERNALERROR, "IO Error"); - } catch (IOException ioex) { - logger.error("Failed to write to {}", file); - return new Status(StatusCode.INTERNALERROR, "IO Error"); - } finally { - if (oos != null) { - try { - oos.close(); - } catch (IOException ioex) { - logger.error("Failed to close object output stream: {}", - file); - } - } - if (fos != null) { - try { - fos.close(); - } catch (IOException ioex) { - logger - .error("Failed to close output file stream: {}", - file); - } - } - } - return new Status(StatusCode.SUCCESS); - } -}