Interface DataOutputStream
public interface DataOutputStream
The data output stream provides a means in which data can be written to a stream.
-
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Flushes the output, closes this stream and frees up any allocated resources.voidwrite(byte[] buf, long n) Writesnbytes to this stream.voidwriteStream(DataInputStream stream) Writes a stream to this stream.
-
Method Details
-
write
Writesnbytes to this stream.- Parameters:
buf- the buffer containing the data to writen- the number ofbytesto write- Throws:
IllegalStateException- this stream has been closedInvalidArgumentException-bufdoes not containn bytesNullArgumentException-bufisnullOperationFailedException- unable to complete request- Compliance:
mandatory- This method must be implemented.
-
writeStream
Writes a stream to this stream.- Parameters:
stream- an input stream- Throws:
IllegalStateException- this stream has been closedNullArgumentException-streamisnullOperationFailedException- unable to complete request- Compliance:
mandatory- This method must be implemented.
-
close
void close()Flushes the output, closes this stream and frees up any allocated resources. Methods in this object may not be invoked after this method is called.- Throws:
IllegalStateException- this stream has been closed- Compliance:
mandatory- This method must be implemented.
-