001/*-
002 * Copyright 2015, 2016 Diamond Light Source Ltd.
003 *
004 * All rights reserved. This program and the accompanying materials
005 * are made available under the terms of the Eclipse Public License v1.0
006 * which accompanies this distribution, and is available at
007 * http://www.eclipse.org/legal/epl-v10.html
008 */
009
010package org.eclipse.january.io;
011
012import java.io.IOException;
013
014import org.eclipse.january.IMonitor;
015import org.eclipse.january.dataset.IDataset;
016import org.eclipse.january.dataset.SliceND;
017
018/**
019 * Used by lazy writeable datasets to write slices to a file
020 */
021public interface ILazySaver extends ILazyLoader {
022        public static final long serialVersionUID = 1366057382940519510L;
023
024        /**
025         * Initialize dataset in file
026         * @throws IOException when cannot open destination
027         */
028        public void initialize() throws IOException;
029
030        /**
031         * @return true if file is writeable
032         */
033        public boolean isFileWriteable();
034
035        /**
036         * @param mon can be null
037         * @param data to use
038         * @param slice destination where to set with items of data
039         * @throws IOException when cannot write data
040         */
041        public void setSlice(IMonitor mon, IDataset data, SliceND slice) throws IOException;
042}