All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.xadisk.bridge.proxies.interfaces.XAFileOutputStream Maven / Gradle / Ivy

There is a newer version: 1.2.2
Show newest version
/*
Copyright © 2010, Nitin Verma (project owner for XADisk https://xadisk.dev.java.net/). All rights reserved.

This source code is being made available to the public under the terms specified in the license
"Eclipse Public License 1.0" located at http://www.opensource.org/licenses/eclipse-1.0.php.
*/


package org.xadisk.bridge.proxies.interfaces;

import java.io.OutputStream;
import org.xadisk.additional.XAFileOutputStreamWrapper;
import org.xadisk.filesystem.exceptions.ClosedStreamException;
import org.xadisk.filesystem.exceptions.NoTransactionAssociatedException;

/**
 * Represents an output stream to a file. This stream always appends to the target file.
 * Such a stream can be opened through the
 * {@link XADiskBasicIOOperations#createXAFileOutputStream(File, boolean) createXAFileOutputStream} method.
 * 

This stream can be further wrapped by a utility class {@link XAFileOutputStreamWrapper} to * get easy pluggability via the standard {@link OutputStream}. * * @since 1.0 */ public interface XAFileOutputStream { /** * Writes all bytes from b into the file. * @param b the byte array to write. * @throws ClosedStreamException * @throws NoTransactionAssociatedException */ public void write(byte[] b) throws ClosedStreamException, NoTransactionAssociatedException; /** * Writes the input byte into the file. * @param b the byte to write. * @throws ClosedStreamException * @throws NoTransactionAssociatedException */ public void write(int b) throws ClosedStreamException, NoTransactionAssociatedException; /** * Writes bytes from array b, starting at offset off, upto * total length bytes, into the file. * @param b the byte array. * @param off offset in the byte array. * @param length number of bytes to write. * @throws ClosedStreamException * @throws NoTransactionAssociatedException */ public void write(byte[] b, int off, int length) throws ClosedStreamException, NoTransactionAssociatedException; /** * Flushes the buffer of this stream. This does not imply that the data gets written * to the disk. A guarantee for the buffered data to get persisted is made only after * the current transaction gets committed successfully. * @throws ClosedStreamException * @throws NoTransactionAssociatedException */ public void flush() throws ClosedStreamException, NoTransactionAssociatedException; /** * Closes this stream. After closing, this stream becomes invalid for any i/o operations. * @throws NoTransactionAssociatedException */ public void close() throws NoTransactionAssociatedException; /** * Tells whether this stream has been closed. * @return true if the stream is closed; false otherwise. */ public boolean isClosed(); }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy