1 /*
   2  * Copyright (c) 1997, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package sun.rmi.log;
  27 
  28 import java.io.*;
  29 
  30 public
  31 class LogOutputStream extends OutputStream {
  32 
  33     private RandomAccessFile raf;
  34 
  35     /**
  36      * Creates an output file with the specified system dependent
  37      * file descriptor.
  38      * @param fd the system dependent file descriptor
  39      * @exception IOException If an I/O error has occurred.
  40      */
  41     public LogOutputStream(RandomAccessFile raf) throws IOException {
  42         this.raf = raf;
  43     }
  44 
  45     /**
  46      * Writes a byte of data. This method will block until the byte is
  47      * actually written.
  48      * @param b the byte to be written
  49      * @exception IOException If an I/O error has occurred.
  50      */
  51     public void write(int b) throws IOException {
  52         raf.write(b);
  53     }
  54 
  55     /**
  56      * Writes an array of bytes. Will block until the bytes
  57      * are actually written.
  58      * @param b the data to be written
  59      * @exception IOException If an I/O error has occurred.
  60      */
  61     public void write(byte b[]) throws IOException {
  62         raf.write(b);
  63     }
  64 
  65     /**
  66      * Writes a sub array of bytes.
  67      * @param b the data to be written
  68      * @param off       the start offset in the data
  69      * @param len       the number of bytes that are written
  70      * @exception IOException If an I/O error has occurred.
  71      */
  72     public void write(byte b[], int off, int len) throws IOException {
  73         raf.write(b, off, len);
  74     }
  75 
  76     /**
  77      * Can not close a LogOutputStream, so this does nothing.
  78      * @exception IOException If an I/O error has occurred.
  79      */
  80     public final void close() throws IOException {
  81     }
  82 
  83 }