public int write(byte[] buf, int size)
  {
    if (mOpenStream == null ||
        !(mOpenStream instanceof WritableByteChannel))
      return -1;

    try
    {
      WritableByteChannel channel = (WritableByteChannel) mOpenStream;
      ByteBuffer buffer = ByteBuffer.allocate(size);
      buffer.put(buf, 0, size);
      buffer.flip();
      return channel.write(buffer);
    }
    catch (IOException e)
    {
      log.error("Got error writing to file: {}; {}", mOpenStream, e);
      return -1;
    }
  }
public int write(byte[] buf, int size)
  {
    if (mOpenStream == null ||
        !(mOpenStream instanceof WritableByteChannel))
      return -1;

    try
    {
      WritableByteChannel channel = (WritableByteChannel) mOpenStream;
      ByteBuffer buffer = ByteBuffer.allocate(size);
      buffer.put(buf, 0, size);
      buffer.flip();
      return channel.write(buffer);
    }
    catch (IOException e)
    {
      log.error("Got error writing to file: {}; {}", mOpenStream, e);
      return -1;
    }
  }
public int write ( byte [ ] buf , int size ) { if ( mOpenStream == null || ! ( mOpenStream instanceof WritableByteChannel ) ) return - 1 ; try { WritableByteChannel channel = ( WritableByteChannel ) mOpenStream ; ByteBuffer buffer = ByteBuffer . allocate ( size ) ; buffer . put ( buf , 0 , size ) ; buffer . flip ( ) ; return channel . write ( buffer ) ; } catch ( IOException e ) { log . error ( "Got error writing to file: {}; {}" , mOpenStream , e ) ; return - 1 ; } }
{@inheritDoc}
{