com.mucommander.file.impl.smb
Class SMBFile.SMBRandomAccessOutputStream

java.lang.Object
  extended by java.io.OutputStream
      extended by com.mucommander.io.RandomAccessOutputStream
          extended by com.mucommander.file.impl.smb.SMBFile.SMBRandomAccessOutputStream
All Implemented Interfaces:
RandomAccess, java.io.Closeable, java.io.Flushable
Enclosing class:
SMBFile

public static class SMBFile.SMBRandomAccessOutputStream
extends RandomAccessOutputStream

SMBRandomAccessOutputStream extends RandomAccessOutputStream to provide random write access to an SMBFile.


Constructor Summary
SMBFile.SMBRandomAccessOutputStream(jcifs.smb.SmbRandomAccessFile raf)
           
 
Method Summary
 void close()
          Closes this stream and releases any system resources associated with the stream.
 long getLength()
          Returns the length of the file, in bytes.
 long getOffset()
          Returns the offset (in bytes) from the beginning of the file at which the next read or write occurs.
 void seek(long offset)
          Sets the offset, measured from the beginning of the file, at which the next read or write occurs.
 void setLength(long newLength)
          Sets the length of the file.
 void write(byte[] b)
          Writes b.length bytes from the specified byte array to this file, starting at the current file offset.
 void write(byte[] b, int off, int len)
          Writes len bytes from the specified byte array starting at offset off to this file.
 void write(int i)
           
 
Methods inherited from class java.io.OutputStream
flush
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SMBFile.SMBRandomAccessOutputStream

public SMBFile.SMBRandomAccessOutputStream(jcifs.smb.SmbRandomAccessFile raf)
Method Detail

write

public void write(int i)
           throws java.io.IOException
Specified by:
write in class java.io.OutputStream
Throws:
java.io.IOException

write

public void write(byte[] b)
           throws java.io.IOException
Description copied from class: RandomAccessOutputStream
Writes b.length bytes from the specified byte array to this file, starting at the current file offset.

Specified by:
write in class RandomAccessOutputStream
Parameters:
b - the data to write
Throws:
java.io.IOException - if an I/O error occurs

write

public void write(byte[] b,
                  int off,
                  int len)
           throws java.io.IOException
Description copied from class: RandomAccessOutputStream
Writes len bytes from the specified byte array starting at offset off to this file.

Specified by:
write in class RandomAccessOutputStream
Parameters:
b - the data to write
off - the start offset in the data array
len - the number of bytes to write
Throws:
java.io.IOException - if an I/O error occurs

close

public void close()
           throws java.io.IOException
Description copied from class: RandomAccessOutputStream
Closes this stream and releases any system resources associated with the stream. A closed stream cannot perform output operations and cannot be reopened.

Specified by:
close in interface RandomAccess
Specified by:
close in interface java.io.Closeable
Specified by:
close in class RandomAccessOutputStream
Throws:
java.io.IOException - if an I/O error occurs.

getOffset

public long getOffset()
               throws java.io.IOException
Description copied from interface: RandomAccess
Returns the offset (in bytes) from the beginning of the file at which the next read or write occurs.

Returns:
the offset (in bytes) from the beginning of the file at which the next read or write occurs
Throws:
java.io.IOException - if an I/O error occurs.

getLength

public long getLength()
               throws java.io.IOException
Description copied from interface: RandomAccess
Returns the length of the file, in bytes.

Returns:
the length of the file, in bytes
Throws:
java.io.IOException - if an I/O error occurs

seek

public void seek(long offset)
          throws java.io.IOException
Description copied from interface: RandomAccess
Sets the offset, measured from the beginning of the file, at which the next read or write occurs. The offset may be set beyond the end of the file. Setting the offset beyond the end of the file does not change the file length. The file length will change only by writing after the offset has been set beyond the end of the file.

Parameters:
offset - the new offset position, measured in bytes from the beginning of the file
Throws:
java.io.IOException - if an I/O error occurs

setLength

public void setLength(long newLength)
               throws java.io.IOException
Description copied from class: RandomAccessOutputStream
Sets the length of the file.

If the present length of the file as returned by the RandomAccess.getLength() method is greater than the newLength argument then the file will be truncated. In this case, if the file offset as returned by the RandomAccess.getOffset() method is greater than newLength then the offset will be equal to newLength after this method returns .

If the present length of the file as returned by the RandomAccess.getLength() method is smaller than the newLength argument then the file will be extended. In this case, the contents of the extended portion of the file are not defined.

Specified by:
setLength in class RandomAccessOutputStream
Parameters:
newLength - the new file's length
Throws:
java.io.IOException - If an I/O error occurred while trying to change the file's length


This file is part of muCommander - Copyright (C) 2002-2008 Maxence Bernard