Java Code Examples for sun.misc.IoTrace#fileWriteBegin()

The following examples show how to use sun.misc.IoTrace#fileWriteBegin() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RandomAccessFile.java    From jdk-1.7-annotated with Apache License 2.0 5 votes vote down vote up
/**
 * Writes the specified byte to this file. The write starts at
 * the current file pointer.
 *
 * @param      b   the <code>byte</code> to be written.
 * @exception  IOException  if an I/O error occurs.
 */
public void write(int b) throws IOException {
    Object traceContext = IoTrace.fileWriteBegin(path);
    int bytesWritten = 0;
    try {
        write0(b);
        bytesWritten = 1;
    } finally {
        IoTrace.fileWriteEnd(traceContext, bytesWritten);
    }
}
 
Example 2
Source File: RandomAccessFile.java    From jdk-1.7-annotated with Apache License 2.0 5 votes vote down vote up
/**
 * Writes a sub array as a sequence of bytes.
 * @param b the data to be written
 * @param off the start offset in the data
 * @param len the number of bytes that are written
 * @exception IOException If an I/O error has occurred.
 */
private void writeBytes(byte b[], int off, int len) throws IOException {
    Object traceContext = IoTrace.fileWriteBegin(path);
    int bytesWritten = 0;
    try {
        writeBytes0(b, off, len);
        bytesWritten = len;
    } finally {
        IoTrace.fileWriteEnd(traceContext, bytesWritten);
    }
}
 
Example 3
Source File: FileOutputStream.java    From jdk-1.7-annotated with Apache License 2.0 5 votes vote down vote up
/**
 * Writes the specified byte to this file output stream. Implements
 * the <code>write</code> method of <code>OutputStream</code>.
 *
 * @param      b   the byte to be written.
 * @exception  IOException  if an I/O error occurs.
 */
public void write(int b) throws IOException {
    Object traceContext = IoTrace.fileWriteBegin(path);
    int bytesWritten = 0;
    try {
        write(b, append);
        bytesWritten = 1;
    } finally {
        IoTrace.fileWriteEnd(traceContext, bytesWritten);
    }
}
 
Example 4
Source File: FileOutputStream.java    From jdk-1.7-annotated with Apache License 2.0 5 votes vote down vote up
/**
 * Writes <code>b.length</code> bytes from the specified byte array
 * to this file output stream.
 *
 * @param      b   the data.
 * @exception  IOException  if an I/O error occurs.
 */
public void write(byte b[]) throws IOException {
    Object traceContext = IoTrace.fileWriteBegin(path);
    int bytesWritten = 0;
    try {
        writeBytes(b, 0, b.length, append);
        bytesWritten = b.length;
    } finally {
        IoTrace.fileWriteEnd(traceContext, bytesWritten);
    }
}
 
Example 5
Source File: FileOutputStream.java    From jdk-1.7-annotated with Apache License 2.0 5 votes vote down vote up
/**
 * Writes <code>len</code> bytes from the specified byte array
 * starting at offset <code>off</code> to this file output stream.
 *
 * @param      b     the data.
 * @param      off   the start offset in the data.
 * @param      len   the number of bytes to write.
 * @exception  IOException  if an I/O error occurs.
 */
public void write(byte b[], int off, int len) throws IOException {
    Object traceContext = IoTrace.fileWriteBegin(path);
    int bytesWritten = 0;
    try {
        writeBytes(b, off, len, append);
        bytesWritten = len;
    } finally {
        IoTrace.fileWriteEnd(traceContext, bytesWritten);
    }
}