public class SyncRemoteFileChannel extends Object implements tecgraf.ftc.common.logic.RemoteFileChannel
| Constructor and Description |
|---|
SyncRemoteFileChannel(byte[] id,
boolean writable,
String host,
int port,
byte[] key)
Constrói um canal para acesso a um arquivo remoto.
|
SyncRemoteFileChannel(tecgraf.ftc.common.logic.RemoteFileChannel channel)
Constrói um canal para acesso a um arquivo remoto.
|
SyncRemoteFileChannel(tecgraf.ftc.common.logic.RemoteFileChannelInfo info)
Constrói um canal para acesso a um arquivo remoto.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
long |
getPosition() |
long |
getSize() |
boolean |
isOpen() |
boolean |
open(boolean readOnly) |
int |
read(byte[] target) |
int |
read(byte[] target,
int offset,
int length) |
int |
read(byte[] target,
int offset,
int length,
long position) |
int |
read(byte[] target,
long position) |
void |
setPosition(long position) |
void |
setSize(long size) |
int |
syncRead(byte[] target,
int offset,
int length,
long position)
Lê uma sequência de bytes do arquivo.
|
long |
syncTransferFrom(InputStream source,
long position,
long count)
Transfere os dados de um fluxo de entrada para o arquivo.
|
long |
syncTransferFrom(tecgraf.ftc.common.logic.RemoteFileChannel source,
long position,
long count)
Transfere os dados de um outro arquivo remoto para o arquivo.
|
long |
syncTransferTo(long position,
long count,
OutputStream target)
Transfere os dados do arquivo para um fluxo de saída.
|
long |
syncTransferTo(long position,
long count,
tecgraf.ftc.common.logic.RemoteFileChannel target)
Transfere os dados do arquivo para um outro arquivo remoto.
|
void |
syncWrite(byte[] source,
int offset,
int length,
long position)
Escreve uma sequência de bytes do arquivo.
|
long |
transferFrom(InputStream source,
long position,
long count) |
long |
transferFrom(tecgraf.ftc.common.logic.RemoteFileChannel source,
long position,
long count) |
long |
transferTo(long position,
long count,
OutputStream target) |
long |
transferTo(long position,
long count,
tecgraf.ftc.common.logic.RemoteFileChannel target) |
int |
write(byte[] source) |
int |
write(byte[] source,
int offset,
int length) |
int |
write(byte[] source,
int offset,
int length,
long position) |
int |
write(byte[] source,
long position) |
public SyncRemoteFileChannel(tecgraf.ftc.common.logic.RemoteFileChannelInfo info)
info - Informações que descrevem o canal para um arquivo remoto.public SyncRemoteFileChannel(byte[] id,
boolean writable,
String host,
int port,
byte[] key)
id - 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.public SyncRemoteFileChannel(tecgraf.ftc.common.logic.RemoteFileChannel channel)
channel - O canal sobre o qual este irá atuar.public boolean open(boolean readOnly)
throws tecgraf.ftc.common.exception.PermissionException,
FileNotFoundException,
tecgraf.ftc.common.exception.FailureException,
tecgraf.ftc.common.exception.MaxClientsReachedException
open in interface tecgraf.ftc.common.logic.RemoteFileChanneltecgraf.ftc.common.exception.PermissionExceptionFileNotFoundExceptiontecgraf.ftc.common.exception.FailureExceptiontecgraf.ftc.common.exception.MaxClientsReachedExceptionpublic boolean isOpen()
isOpen in interface tecgraf.ftc.common.logic.RemoteFileChannelpublic void close()
throws tecgraf.ftc.common.exception.FailureException
close in interface tecgraf.ftc.common.logic.RemoteFileChanneltecgraf.ftc.common.exception.FailureExceptionpublic long getPosition()
getPosition in interface tecgraf.ftc.common.logic.RemoteFileChannelpublic void setPosition(long position)
throws tecgraf.ftc.common.exception.FailureException
setPosition in interface tecgraf.ftc.common.logic.RemoteFileChanneltecgraf.ftc.common.exception.FailureExceptionpublic long getSize()
getSize in interface tecgraf.ftc.common.logic.RemoteFileChannelpublic void setSize(long size)
throws tecgraf.ftc.common.exception.PermissionException,
tecgraf.ftc.common.exception.FailureException
setSize in interface tecgraf.ftc.common.logic.RemoteFileChanneltecgraf.ftc.common.exception.PermissionExceptiontecgraf.ftc.common.exception.FailureExceptionpublic int read(byte[] target)
throws tecgraf.ftc.common.exception.FailureException
read in interface tecgraf.ftc.common.logic.RemoteFileChanneltecgraf.ftc.common.exception.FailureExceptionpublic int read(byte[] target,
long position)
throws tecgraf.ftc.common.exception.FailureException
read in interface tecgraf.ftc.common.logic.RemoteFileChanneltecgraf.ftc.common.exception.FailureExceptionpublic int read(byte[] target,
int offset,
int length)
throws tecgraf.ftc.common.exception.FailureException
read in interface tecgraf.ftc.common.logic.RemoteFileChanneltecgraf.ftc.common.exception.FailureExceptionpublic int read(byte[] target,
int offset,
int length,
long position)
throws tecgraf.ftc.common.exception.FailureException
read in interface tecgraf.ftc.common.logic.RemoteFileChanneltecgraf.ftc.common.exception.FailureExceptionpublic int syncRead(byte[] target,
int offset,
int length,
long position)
throws tecgraf.ftc.common.exception.FailureException
target - O array a ser preenchido.offset - O deslocamento no array a partir do qual os bytes serão
armazenados.length - A quantidade de bytes a serem lidos do arquivo.position - A posição do arquivo a partir da qual a leitura deve ser
iniciada.tecgraf.ftc.common.exception.FailureException - Caso ocorra alguma falha no procedimento.public int write(byte[] source)
throws tecgraf.ftc.common.exception.PermissionException,
tecgraf.ftc.common.exception.FailureException,
tecgraf.ftc.common.exception.FileLockedException
write in interface tecgraf.ftc.common.logic.RemoteFileChanneltecgraf.ftc.common.exception.PermissionExceptiontecgraf.ftc.common.exception.FailureExceptiontecgraf.ftc.common.exception.FileLockedExceptionpublic int write(byte[] source,
long position)
throws tecgraf.ftc.common.exception.PermissionException,
tecgraf.ftc.common.exception.FailureException,
tecgraf.ftc.common.exception.FileLockedException
write in interface tecgraf.ftc.common.logic.RemoteFileChanneltecgraf.ftc.common.exception.PermissionExceptiontecgraf.ftc.common.exception.FailureExceptiontecgraf.ftc.common.exception.FileLockedExceptionpublic int write(byte[] source,
int offset,
int length)
throws tecgraf.ftc.common.exception.PermissionException,
tecgraf.ftc.common.exception.FailureException,
tecgraf.ftc.common.exception.FileLockedException
write in interface tecgraf.ftc.common.logic.RemoteFileChanneltecgraf.ftc.common.exception.PermissionExceptiontecgraf.ftc.common.exception.FailureExceptiontecgraf.ftc.common.exception.FileLockedExceptionpublic int write(byte[] source,
int offset,
int length,
long position)
throws tecgraf.ftc.common.exception.PermissionException,
tecgraf.ftc.common.exception.FailureException,
tecgraf.ftc.common.exception.FileLockedException
write in interface tecgraf.ftc.common.logic.RemoteFileChanneltecgraf.ftc.common.exception.PermissionExceptiontecgraf.ftc.common.exception.FailureExceptiontecgraf.ftc.common.exception.FileLockedExceptionpublic void syncWrite(byte[] source,
int offset,
int length,
long position)
throws tecgraf.ftc.common.exception.PermissionException,
tecgraf.ftc.common.exception.FailureException,
tecgraf.ftc.common.exception.FileLockedException
source - O array contendo os bytes a serem escritos no arquivo.offset - O deslocamento no array a partir do qual os bytes serão
lidos.length - A quantidade de bytes a serem escritos do arquivo.position - A posição do arquivo a partir da qual a escrita deve ser
iniciada.tecgraf.ftc.common.exception.PermissionException - em caso de erro de permissãotecgraf.ftc.common.exception.FailureException - em caso de falha no procedimento.tecgraf.ftc.common.exception.FileLockedException - no caso do arquivo estar bloqueado.public long transferTo(long position,
long count,
OutputStream target)
throws tecgraf.ftc.common.exception.FailureException
transferTo in interface tecgraf.ftc.common.logic.RemoteFileChanneltecgraf.ftc.common.exception.FailureExceptionpublic long syncTransferTo(long position,
long count,
OutputStream target)
throws tecgraf.ftc.common.exception.FailureException
position - A posição inicial a partir da qual o arquivo será lido.count - A quantidade de bytes que serão transferidos.target - O fluxo de saída que receberá os dados do arquivo.tecgraf.ftc.common.exception.FailureException - Caso ocorra alguma falha no procedimento.public long transferTo(long position,
long count,
tecgraf.ftc.common.logic.RemoteFileChannel target)
throws tecgraf.ftc.common.exception.PermissionException,
tecgraf.ftc.common.exception.FailureException,
tecgraf.ftc.common.exception.FileLockedException
transferTo in interface tecgraf.ftc.common.logic.RemoteFileChanneltecgraf.ftc.common.exception.PermissionExceptiontecgraf.ftc.common.exception.FailureExceptiontecgraf.ftc.common.exception.FileLockedExceptionpublic long syncTransferTo(long position,
long count,
tecgraf.ftc.common.logic.RemoteFileChannel target)
throws tecgraf.ftc.common.exception.PermissionException,
tecgraf.ftc.common.exception.FailureException,
tecgraf.ftc.common.exception.FileLockedException
position - A posição inicial a partir da qual o arquivo será lido.count - A quantidade de bytes que serão transferidos.target - O canal do arquivo que receberá os dados.tecgraf.ftc.common.exception.PermissionException - Caso o outro arquivo remoto tenha sido aberto
somente para leitura.tecgraf.ftc.common.exception.FailureException - Caso ocorra alguma falha no procedimento.tecgraf.ftc.common.exception.FileLockedException - Caso o outro arquivo remoto esteja reservado
para outro usuário.public long transferFrom(InputStream source, long position, long count) throws tecgraf.ftc.common.exception.PermissionException, tecgraf.ftc.common.exception.FailureException, tecgraf.ftc.common.exception.FileLockedException
transferFrom in interface tecgraf.ftc.common.logic.RemoteFileChanneltecgraf.ftc.common.exception.PermissionExceptiontecgraf.ftc.common.exception.FailureExceptiontecgraf.ftc.common.exception.FileLockedExceptionpublic long syncTransferFrom(InputStream source, long position, long count) throws tecgraf.ftc.common.exception.PermissionException, tecgraf.ftc.common.exception.FailureException, tecgraf.ftc.common.exception.FileLockedException
source - O fluxo de entrada.position - A posição inicial a partir da qual o arquivo será escrito.count - A quantidade de bytes que serão transferidos.tecgraf.ftc.common.exception.PermissionException - Caso o arquivo tenha sido aberto somente para
leitura.tecgraf.ftc.common.exception.FailureException - Caso ocorra alguma falha no procedimento.tecgraf.ftc.common.exception.FileLockedException - Indica que o arquivo está reservado para outro
usuário.public long transferFrom(tecgraf.ftc.common.logic.RemoteFileChannel source,
long position,
long count)
throws tecgraf.ftc.common.exception.PermissionException,
tecgraf.ftc.common.exception.FailureException,
tecgraf.ftc.common.exception.FileLockedException
transferFrom in interface tecgraf.ftc.common.logic.RemoteFileChanneltecgraf.ftc.common.exception.PermissionExceptiontecgraf.ftc.common.exception.FailureExceptiontecgraf.ftc.common.exception.FileLockedExceptionpublic long syncTransferFrom(tecgraf.ftc.common.logic.RemoteFileChannel source,
long position,
long count)
throws tecgraf.ftc.common.exception.PermissionException,
tecgraf.ftc.common.exception.FailureException,
tecgraf.ftc.common.exception.FileLockedException
source - O fluxo de entrada.position - A posição inicial a partir da qual o arquivo será escrito.count - A quantidade de bytes que serão transferidos.tecgraf.ftc.common.exception.PermissionException - Caso o arquivo tenha sido aberto somente para
leitura.tecgraf.ftc.common.exception.FailureException - Caso ocorra alguma falha no procedimento.tecgraf.ftc.common.exception.FileLockedException - Indica que o arquivo está reservado para outro
usuário.Copyright © 2021. All rights reserved.