tecgraf.ftc_1_2.utils
Class IOUtils

java.lang.Object
  extended by tecgraf.ftc_1_2.utils.IOUtils

public class IOUtils
extends Object

Classe de métodos utilitários para operações de I/O.

Author:
Tecgraf

Constructor Summary
IOUtils()
           
 
Method Summary
static long transferFromNonBlock(FileChannel dstChannel, long position, long count, ReadableByteChannel srcChannel, ByteBuffer buffer)
           
static long transferTo(FileChannel srcChannel, long position, long count, WritableByteChannel dstChannel)
          Sobrecarga do método transferTo(FileChannel, long, long, WritableByteChannel, ByteBuffer) que já especifica um buffer default de 1 MB.
static long transferTo(FileChannel srcChannel, long position, long count, WritableByteChannel dstChannel, ByteBuffer buffer)
           Método para transferência de bytes de um FileChannel para um WritableByteChannel.
static long transferToNonBlock(FileChannel srcChannel, long position, long count, WritableByteChannel dstChannel, ByteBuffer buffer)
           Método para transferência de bytes de um FileChannel para um WritableByteChannel.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IOUtils

public IOUtils()
Method Detail

transferTo

public static long transferTo(FileChannel srcChannel,
                              long position,
                              long count,
                              WritableByteChannel dstChannel)
                       throws IOException
Sobrecarga do método transferTo(FileChannel, long, long, WritableByteChannel, ByteBuffer) que já especifica um buffer default de 1 MB.

Parameters:
srcChannel - FileChannel de origem para o arquivo a ser transmitido.
position - posição a partir da qual o arquivo deverá ser transmitido.
count - número de bytes a serem transmitidos.
dstChannel - WritableByteChannel de destino para a transferência.
Returns:
número de bytes efetivamente transmitidos.
Throws:
IOException

transferTo

public static long transferTo(FileChannel srcChannel,
                              long position,
                              long count,
                              WritableByteChannel dstChannel,
                              ByteBuffer buffer)
                       throws IOException

Método para transferência de bytes de um FileChannel para um WritableByteChannel. Este método procura suprir a deficiência do FileChannel.transferTo(long, long, WritableByteChannel) em lidar com arquivos acima de 2GB. Vide "http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6253145" .

Procurou-se seguir a assinatura e comportamento esperado do método original. Para maiores referências, consulte a API da Sun.

Parameters:
srcChannel - FileChannel de origem para o arquivo a ser transmitido.
position - posição a partir da qual o arquivo deverá ser transmitido.
count - número de bytes a serem transmitidos.
dstChannel - WritableByteChannel de destino para a transferência.
buffer - buffer a ser usado para a transferência.
Returns:
número de bytes efetivamente transmitidos.
Throws:
IOException

transferToNonBlock

public static long transferToNonBlock(FileChannel srcChannel,
                                      long position,
                                      long count,
                                      WritableByteChannel dstChannel,
                                      ByteBuffer buffer)
                               throws IOException

Método para transferência de bytes de um FileChannel para um WritableByteChannel. Este método procura suprir a deficiência do FileChannel.transferTo(long, long, WritableByteChannel) em lidar com arquivos acima de 2GB. Vide "http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6253145" .

Procurou-se seguir a assinatura e comportamento esperado do método original. Para maiores referências, consulte a API da Sun.

Parameters:
srcChannel - FileChannel de origem para o arquivo a ser transmitido.
position - posição a partir da qual o arquivo deverá ser transmitido.
count - número de bytes a serem transmitidos.
dstChannel - WritableByteChannel de destino para a transferência.
buffer - buffer a ser usado para a transferência.
Returns:
número de bytes efetivamente transmitidos.
Throws:
IOException

transferFromNonBlock

public static long transferFromNonBlock(FileChannel dstChannel,
                                        long position,
                                        long count,
                                        ReadableByteChannel srcChannel,
                                        ByteBuffer buffer)
                                 throws IOException
Throws:
IOException


Copyright © 2017 Tecgraf/PUC-Rio. All rights reserved.