/** * Writes <code>b.length</code> bytes from the specified byte array to this output stream. * * @param data * A <code>byte</code> array which represents the data to write. * * @throws IOException * If an I/O error occurs. In particular, an IOException may be thrown if the output stream has been * closed. */ @Override @DoesServiceRequest public void write(final byte[] data) throws IOException { this.write(data, 0, data.length); }
/** * Flushes this output stream and forces any buffered output bytes to be written out. If any data remains in the * buffer it is committed to the service. * * @throws IOException * If an I/O error occurs. */ @Override @DoesServiceRequest public synchronized void flush() throws IOException { this.checkStreamState(); // Dispatch a write for the current bytes in the buffer this.dispatchWrite(this.currentBufferedBytes); // Waits for all submitted tasks to complete while (this.outstandingRequests > 0) { // Wait for a task to complete this.waitForTaskToComplete(); // If that task threw an error, fail fast this.checkStreamState(); } }
this.checkStreamState(); this.flush(); this.commit();
private synchronized void writeInternal(final byte[] data, int offset, int length) throws IOException { while (length > 0) { this.checkStreamState(); this.dispatchWrite(this.internalWriteThreshold);
/** * Writes length bytes from the specified byte array starting at offset to this output stream. * * @param data * A <code>byte</code> array which represents the data to write. * @param offset * An <code>int</code> which represents the start offset in the data. * @param length * An <code>int</code> which represents the number of bytes to write. * * @throws IOException * If an I/O error occurs. In particular, an IOException may be thrown if the output stream has been * closed. */ @Override @DoesServiceRequest public void write(final byte[] data, final int offset, final int length) throws IOException { if (offset < 0 || length < 0 || length > data.length - offset) { throw new IndexOutOfBoundsException(); } this.writeInternal(data, offset, length); }
return new FileOutputStream(this, length, accessCondition, options, opContext);
private synchronized void writeInternal(final byte[] data, int offset, int length) throws IOException { while (length > 0) { this.checkStreamState(); this.dispatchWrite(this.internalWriteThreshold);
/** * Writes length bytes from the specified byte array starting at offset to this output stream. * * @param data * A <code>byte</code> array which represents the data to write. * @param offset * An <code>int</code> which represents the start offset in the data. * @param length * An <code>int</code> which represents the number of bytes to write. * * @throws IOException * If an I/O error occurs. In particular, an IOException may be thrown if the output stream has been * closed. */ @Override @DoesServiceRequest public void write(final byte[] data, final int offset, final int length) throws IOException { if (offset < 0 || length < 0 || length > data.length - offset) { throw new IndexOutOfBoundsException(); } this.writeInternal(data, offset, length); }
return new FileOutputStream(this, length, accessCondition, options, opContext);
/** * Flushes this output stream and forces any buffered output bytes to be written out. If any data remains in the * buffer it is committed to the service. * * @throws IOException * If an I/O error occurs. */ @Override @DoesServiceRequest public synchronized void flush() throws IOException { this.checkStreamState(); // Dispatch a write for the current bytes in the buffer this.dispatchWrite(this.currentBufferedBytes); // Waits for all submitted tasks to complete while (this.outstandingRequests > 0) { // Wait for a task to complete this.waitForTaskToComplete(); // If that task threw an error, fail fast this.checkStreamState(); } }
this.checkStreamState(); this.flush(); this.commit();
/** * Writes <code>b.length</code> bytes from the specified byte array to this output stream. * * @param data * A <code>byte</code> array which represents the data to write. * * @throws IOException * If an I/O error occurs. In particular, an IOException may be thrown if the output stream has been * closed. */ @Override @DoesServiceRequest public void write(final byte[] data) throws IOException { this.write(data, 0, data.length); }
/** * Writes the specified byte to this output stream. The general contract for write is that one byte is written to * the output stream. The byte to be written is the eight low-order bits of the argument b. The 24 high-order bits * of b are ignored. * * @param byteVal * An <code>int</code> which represents the bye value to write. * * @throws IOException * If an I/O error occurs. In particular, an IOException may be thrown if the output stream has been * closed. */ @Override @DoesServiceRequest public void write(final int byteVal) throws IOException { this.write(new byte[] { (byte) (byteVal & 0xFF) }); }
/** * Writes the specified byte to this output stream. The general contract for write is that one byte is written to * the output stream. The byte to be written is the eight low-order bits of the argument b. The 24 high-order bits * of b are ignored. * * @param byteVal * An <code>int</code> which represents the bye value to write. * * @throws IOException * If an I/O error occurs. In particular, an IOException may be thrown if the output stream has been * closed. */ @Override @DoesServiceRequest public void write(final int byteVal) throws IOException { this.write(new byte[] { (byte) (byteVal & 0xFF) }); }