|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objecttecgraf.ftc_1_2.client.RemoteFileChannelImpl
public final class RemoteFileChannelImpl
Representa uma implementação de um canal de arquivo remoto.
| Constructor Summary | |
|---|---|
RemoteFileChannelImpl(byte[] identifier,
boolean writable,
String host,
int port,
byte[] key)
Cria um arquivo remoto. |
|
| Method Summary | |
|---|---|
void |
close()
Solicita o fechamento do arquivo. |
int |
getBufferSize()
|
long |
getPosition()
Obtém a posição atual do arquivo. |
long |
getSize()
Obtém o tamanho do arquivo. |
boolean |
isOpen()
Verifica se o arquivo está aberto. |
void |
keepAlive()
Operação que faz um poll no servidor com o intuito de manter a conexao ativa |
void |
open(boolean readOnly)
Solicita a abertura do arquivo. |
int |
read(byte[] target)
Lê uma sequência de bytes do arquivo. |
int |
read(byte[] target,
int offset,
int length)
Lê uma sequência de bytes do arquivo. |
int |
read(byte[] target,
int offset,
int length,
long position)
Lê uma sequência de bytes do arquivo. |
int |
read(byte[] target,
long position)
Lê uma sequência de bytes do arquivo. |
void |
setBufferSize(int bufferSize)
|
void |
setPosition(long position)
Define a nova posição do arquivo. |
void |
setSize(long size)
Altera o tamanho do arquivo para um novo tamanho. |
long |
transferFrom(InputStream source,
long position,
long count)
Transfere os dados de um fluxo de entrada para o arquivo. |
long |
transferFrom(RemoteFileChannel source,
long position,
long count)
Transfere os de um outro arquivo remoto para o arquivo. |
long |
transferTo(long position,
long count,
OutputStream outputStream)
Transfere os dados do arquivo para um fluxo de saída. |
long |
transferTo(long position,
long count,
RemoteFileChannel target)
Transfere os dados do arquivo para um outro arquivo remoto. |
int |
write(byte[] source)
Escreve uma sequência de bytes no arquivo. |
int |
write(byte[] source,
int offset,
int length)
Escreve uma sequência de bytes no arquivo. |
int |
write(byte[] source,
int offset,
int length,
long position)
Escreve uma sequência de bytes no arquivo. |
int |
write(byte[] source,
long position)
Escreve uma sequência de bytes no arquivo. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public RemoteFileChannelImpl(byte[] identifier,
boolean writable,
String host,
int port,
byte[] key)
identifier - O identificador do arquivo.writable - Indica se a escrita é permitida no arquivo.host - A máquina do servidor de arquivos.port - A porta do servidor de arquivos.key - A chave de acesso ao arquivo.| Method Detail |
|---|
public void open(boolean readOnly)
throws PermissionException,
FileNotFoundException,
FailureException,
MaxClientsReachedException,
InvalidProtocolVersionException
open in interface RemoteFileChannelreadOnly - Indica se o arquivo deve ser aberto somente para leitura ou
não.
InvalidProtocolVersionException
PermissionException - Caso o usuário não tenha permissão para
realizar o modo de abertura solicitado.
FileNotFoundException - Caso o arquivo não exista.
FailureException - Caso ocorra alguma falha no procedimento.
MaxClientsReachedException - Caso o servidor não possa mais receber
clientes.public boolean isOpen()
isOpen in interface RemoteFileChanneltrue caso o arquivo esteja aberto, ou false, caso
contrário.
public void close()
throws FailureException
close in interface RemoteFileChannelFailureException - Caso ocorra alguma falha no procedimento.
public void setSize(long size)
throws PermissionException,
FailureException
setSize in interface RemoteFileChannelsize - O novo tamanho.
PermissionException - Caso o arquivo tenha sido aberto somente para
leitura.
FailureException - Caso ocorra alguma falha no procedimento.
public long getPosition()
throws FailureException
getPosition in interface RemoteFileChannelFailureException - Se houver falha na comunicação
public void setPosition(long position)
throws FailureException
setPosition in interface RemoteFileChannelposition - A nova posição.
FailureException - Caso ocorra alguma falha no procedimento.
public long getSize()
throws FailureException
getSize in interface RemoteFileChannelFailureException
public int read(byte[] target)
throws FailureException
read in interface RemoteFileChanneltarget - O buffer.
FailureException - Caso ocorra alguma falha no procedimento.
public int read(byte[] target,
long position)
throws FailureException
read in interface RemoteFileChanneltarget - O buffer.position - A posição do arquivo a partir da qual a leitura vai ser
iniciada.
FailureException - Caso ocorra alguma falha no procedimento.
public int read(byte[] target,
int offset,
int length)
throws FailureException
read in interface RemoteFileChanneltarget - O buffer.offset - O deslocamento no buffer.length - A quantidade máxima de bytes a serem lidos.
FailureException - Caso ocorra alguma falha no procedimento.
public int read(byte[] target,
int offset,
int length,
long position)
throws FailureException
read in interface RemoteFileChanneltarget - O buffer.offset - O deslocamento no buffer.length - A quantidade máxima de bytes a serem lidos.position - A posição do arquivo a partir da qual a leitura vai ser
iniciada.
FailureException - Caso ocorra alguma falha no procedimento.
public int write(byte[] source)
throws PermissionException,
FailureException,
FileLockedException
write in interface RemoteFileChannelsource - O buffer.
PermissionException - Caso o arquivo tenha sido aberto somente para
leitura.
FailureException - Caso ocorra alguma falha no procedimento.
FileLockedException - Indica que o arquivo está reservado para outro
usuário.
public int write(byte[] source,
long position)
throws PermissionException,
FailureException,
FileLockedException
write in interface RemoteFileChannelsource - O buffer.position - A posição do arquivo a partir da qual a escrita vai ser
iniciada.
PermissionException - Caso o arquivo tenha sido aberto somente para
leitura.
FailureException - Caso ocorra alguma falha no procedimento.
FileLockedException - Indica que o arquivo está reservado para outro
usuário.
public int write(byte[] source,
int offset,
int length)
throws PermissionException,
FailureException,
FileLockedException
write in interface RemoteFileChannelsource - O buffer.offset - O deslocamento no buffer.length - A quantidade máxima de bytes a serem escritos.
PermissionException - Caso o arquivo tenha sido aberto somente para
leitura.
FailureException - Caso ocorra alguma falha no procedimento.
FileLockedException - Indica que o arquivo está reservado para outro
usuário.
public int write(byte[] source,
int offset,
int length,
long position)
throws PermissionException,
FailureException,
FileLockedException
write in interface RemoteFileChannelsource - O buffer.offset - O deslocamento no buffer.length - A quantidade máxima de bytes a serem escritos.position - A posição do arquivo a partir da qual a escrita vai ser
iniciada.
PermissionException - Caso o arquivo tenha sido aberto somente para
leitura.
FailureException - Caso ocorra alguma falha no procedimento.
FileLockedException - Indica que o arquivo está reservado para outro
usuário.
public long transferTo(long position,
long count,
OutputStream outputStream)
throws FailureException
transferTo in interface RemoteFileChannelposition - A posição inicial a partir daqual o arquivo será lido.count - A quantidade de bytes que serão transferidos.outputStream - O fluxo de saída que receberá os dados do arquivo.
FailureException - Caso ocorra alguma falha no procedimento.
public long transferTo(long position,
long count,
RemoteFileChannel target)
throws FailureException,
PermissionException,
FileLockedException
transferTo in interface RemoteFileChannelposition - A posição inicial a partir daqual o arquivo será lido.count - A quantidade de bytes que serão transferidos.target - O canal do arquivo que receberá os dados.
FailureException - Caso ocorra alguma falha no procedimento.
PermissionException - Caso o outro arquivo remoto tenha sido aberto
somente para leitura.
FileLockedException - Caso o outro arquivo remoto esteja reservado
para outro usuário.
public long transferFrom(InputStream source,
long position,
long count)
throws PermissionException,
FailureException,
FileLockedException
transferFrom in interface RemoteFileChannelsource - O fluxo de entrada.position - A posição inicial a partir daqual o arquivo será escrito.count - A quantidade de bytes que serão transferidos.
PermissionException - Caso o arquivo tenha sido aberto somente para
leitura.
FailureException - Caso ocorra alguma falha no procedimento.
FileLockedException - Indica que o arquivo está reservado para outro
usuário.
public long transferFrom(RemoteFileChannel source,
long position,
long count)
throws PermissionException,
FailureException,
FileLockedException
transferFrom in interface RemoteFileChannelsource - O canal do arquivo de entrada.position - A posição inicial a partir daqual o arquivo será escrito.count - A quantidade de bytes que serão transferidos.
PermissionException - Caso o arquivo tenha sido aberto somente para
leitura.
FailureException - Caso ocorra alguma falha no procedimento.
FileLockedException - Indica que o arquivo está reservado para outro
usuário.
public void keepAlive()
throws FailureException
keepAlive in interface RemoteFileChannelFailureExceptionpublic void setBufferSize(int bufferSize)
bufferSize - O tamanho do buffer em bytes.public int getBufferSize()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||