Java OutputStream write(byte[] b) MethodThe write(byte[] b) method of OutputStream class is used to write b.length bytes to this output stream from the specified byte array. In general, this method have exactly the same effect as the call write (b, 0, b. length). SyntaxParametersb- It is the data Throws:IOException- If an I/O error occurs ExampleOutput: java Java OutputStream write(byte[] b, int off, int len) MethodThe write(byte[] b, int off, int len) method of OutputStream class is used to write len bytes starting at offset off to this output stream from the specified byte array. In general write(b, off, len) is that some of the bytes in the array b are written to the output stream in order; element b[off] is the first byte written, and b[off+len-1] is the last byte written by this operation. The write method of OutputStream calls the write method of one argument on each of the bytes to be written out. If b is null, a NullPointerException is thrown. SyntaxParametersb- It is the data. off- It is the start offset in the data. len- It is the number of bytes to write. Throws:IOException- If an I/O error occurs, or if the output stream is closed. ExampleOutput: javatpoint Java OutputStream write(int b) MethodThe write(int b) method of OutputStream class is used to write the specified bytes to the output stream. The bytes to be written are the eight low-order bits of the argument b. The 24 high-order bits of b are ignored. Subclass of OutputStream must provide an implementation for this method. SyntaxParametersb- The byte Throws:IOException- If an I/O error occurs or the output stream has been closed. Example 1Output: ABC
Next TopicJava OutputStream
|