com.starla.smb
Class SMBOutputStream

java.lang.Object
  |
  +--java.io.OutputStream
        |
        +--com.starla.smb.SMBOutputStream

public class SMBOutputStream
extends java.io.OutputStream

SMB output stream class.

The SMBOutputStream class provides a standard OutputStream interface to an existing remote file, or can be used to create a new remote file.

The class may be used with other I/O stream classes such as PrintWriter, DataOutputStream etc.

Note: It is not necessary to use a BufferedOutputStream or BufferedWriter class with the SMBOutputStream as the underlying network connection will usually buffer 4Kb of data, up to a maximum of 64Kb.

Example use of the SMBOutputStream class

PCShare shr = new PCShare ( "\\\\TEST\\C\\");
SMBDiskSession sess = SMBSessionFactory.OpenDisk ( shr);
SMBOutputStream out = sess.OpenOutputStream ( "DATAFILE.OUT", SMBAccessMode.WriteOnly);
PrintWriter pWrt = new PrintWriter ( out, false);
for ( int i = 0; i < 20; i++)
  pWrt.println ( "Record " + i);
pWrt.flush ();
out.close ();


Method Summary
 void close()
          Close this output stream and release any system resources associated with the stream.
 SMBFile File()
          Return a reference to the associated SMBFile object.
 void flush()
          Flush this output stream, force any buffered data to be written out.
 void write(byte[] buf, int off, int len)
          Write the specified byte array to the output stream, starting at the specified offset within the byte array.
 void write(int byt)
          Write the specified byte to this output stream.
 
Methods inherited from class java.io.OutputStream
write
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

close

public void close()
           throws java.io.IOException
Close this output stream and release any system resources associated with the stream.
Throws:
java.io.IOException - If an I/O error occurs.
Overrides:
close in class java.io.OutputStream

File

public final SMBFile File()
Return a reference to the associated SMBFile object.
Returns:
SMBFile associated with this output stream.

flush

public void flush()
           throws java.io.IOException
Flush this output stream, force any buffered data to be written out.
Throws:
java.io.IOException - If an I/O error occurs.
Overrides:
flush in class java.io.OutputStream

write

public void write(byte[] buf,
                  int off,
                  int len)
           throws java.io.IOException
Write the specified byte array to the output stream, starting at the specified offset within the byte array.
Parameters:
buf - Byte array containing the data to be output.
off - Offset within the buffer that the data starts.
len - Length of the data to be output.
Throws:
java.io.IOException - If an I/O error occurs.
Overrides:
write in class java.io.OutputStream

write

public void write(int byt)
           throws java.io.IOException
Write the specified byte to this output stream.
Parameters:
byt - Byte to be output to this stream.
Throws:
java.io.IOException - If an I/O error occurs.
Overrides:
write in class java.io.OutputStream