[ 
https://issues.apache.org/jira/browse/SSHD-1101?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17226759#comment-17226759
 ] 

Lyor Goldstein commented on SSHD-1101:
--------------------------------------

{quote}
If I want to access the file properties in SCPFileOpener is there any way, or 
what will be the ideal way to get the file properties like offset, handle etc 
before any scp read and write operation
{quote}
I am not sure we are talking about the right protocol - SCP does not provide 
any "handle" or "offset" - it is an all or nothing protocol. I.e., the +entire+ 
file is read/written. Therefore, if indeed we are talking about SCP then you do 
get all the required parameters via {{SCPFileOpener}} since you are informed of 
the file path (a.k.a. handle), its size (length) and offset (always zero). If 
you mean that you want to control the read/write to the actual files - then 
override the {{openRead/Write}} methods and provide your own 
{{Input/OutputStream}} implementations where you can track the current 
read/write offset and implement what you called
{quote}
void writeBinary(SSHDUnsignedInteger64 offset, byte[] buffer, int start, int 
length) throws IOException
{quote}

> Getting  org.apache.sshd.common.util.buffer.Buffer object in custom 
> ScpFileOpener class
> ---------------------------------------------------------------------------------------
>
>                 Key: SSHD-1101
>                 URL: https://issues.apache.org/jira/browse/SSHD-1101
>             Project: MINA SSHD
>          Issue Type: Question
>            Reporter: Susmit Sarkar
>            Priority: Blocker
>
> Hello Team,
> I am a bit stuck, need your guidance. I want information like
> long offset = buffer.getLong();
> int length = buffer.getInt();
> buffer.array(), buffer.rpos(), buffer.available(), buffer.getString()
> All this are present in buffer object from 
> org.apache.sshd.common.util.buffer.Buffer, but in my CustomSCPFileOpener 
> which implements ScpFileOpener I have this methods:
> *@Override public OutputStream openWrite(Session session, Path file, long 
> size, Set<PosixFilePermission> permissions, OpenOption... options) throws 
> IOException* 
> *@Override public InputStream openRead(Session session, Path file, long size, 
> Set<PosixFilePermission> permissions, OpenOption... options) throws 
> IOException* 
> Can you please help me out how will i fecth the above details as i need to 
> invoke an external API which needs the parameters stated above
> Regards,
> Susmit
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to