Class FSPOutputStream

  • All Implemented Interfaces:
    java.io.Closeable , java.io.Flushable , java.lang.AutoCloseable

    
    public class FSPOutputStream
    extends OutputStream
                        

    Stream for writing file to FSP server. You can not have more than one file opened for write per FSPsession.

    Since:

    1.0rc7

    Author:

    Radim Kolar

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Field Summary

      Fields 
      Modifier and Type Field Description
    • Constructor Summary

      Constructors 
      Constructor Description
      FSPOutputStream(FSPsession session, String filename) Creates stream for writing file to FSP server.
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      void flush() Flushes internal buffer to FSP server.
      void write(int b) Writes single byte to FSP server
      void write(Array<byte> b, int off, int len) Writes byte array to FSP server
      void close() Flushes buffer and installs file.
      void finalize() cancels pending upload and unlocks writer object.
      • Methods inherited from class java.io.OutputStream

        nullOutputStream
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • FSPOutputStream

        FSPOutputStream(FSPsession session, String filename)

        Creates stream for writing file to FSP server. Because FSP protocol always uploads to temporary file no checking if client can really create/overwrite desired file is performed until end of upload. Custom timestamp on uploaded file is not supported by this class. This constructor will block if there is already another active writing stream assigned to FSPsession.

        Parameters:
        session - FSPsession to target server
        filename - filename
    • Method Detail

      • flush

         void flush()

        Flushes internal buffer to FSP server. File on FSP server is not created until stream is closed. This function always sent packet to server even if internal buffer is currently empty.

        Since:

        1.0rc7

      • write

         void write(int b)

        Writes single byte to FSP server

        Parameters:
        b - byte to write
        Since:

        1.0rc7

      • write

         void write(Array<byte> b, int off, int len)

        Writes byte array to FSP server

        Parameters:
        b - array containing data to write
        off - data to write offset
        len - lenght of data to write
        Since:

        1.0rc7

      • close

         void close()

        Flushes buffer and installs file. Setting filestamp on target file is not supported by this function.

        Since:

        1.0rc7

      • finalize

         void finalize()

        cancels pending upload and unlocks writer object. This function will fail if FSPsession was finalized sooner

        Since:

        1.0rc8