001: /*
002: * SSHTools - Java SSH2 API
003: *
004: * Copyright (C) 2002-2003 Lee David Painter and Contributors.
005: *
006: * Contributions made by:
007: *
008: * Brett Smith
009: * Richard Pernavas
010: * Erwin Bolwidt
011: *
012: * This program is free software; you can redistribute it and/or
013: * modify it under the terms of the GNU General Public License
014: * as published by the Free Software Foundation; either version 2
015: * of the License, or (at your option) any later version.
016: *
017: * This program is distributed in the hope that it will be useful,
018: * but WITHOUT ANY WARRANTY; without even the implied warranty of
019: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
020: * GNU General Public License for more details.
021: *
022: * You should have received a copy of the GNU General Public License
023: * along with this program; if not, write to the Free Software
024: * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
025: */
026: package com.sshtools.j2ssh.sftp;
027:
028: import com.sshtools.j2ssh.io.ByteArrayReader;
029: import com.sshtools.j2ssh.io.ByteArrayWriter;
030: import com.sshtools.j2ssh.io.UnsignedInteger32;
031: import com.sshtools.j2ssh.subsystem.SubsystemMessage;
032:
033: /**
034: *
035: *
036: * @author $author$
037: * @version $Revision: 1.16 $
038: */
039: public class SshFxpData extends SubsystemMessage implements
040: MessageRequestId {
041: /** */
042: public static final int SSH_FXP_DATA = 103;
043: private UnsignedInteger32 id;
044: private byte[] data;
045:
046: /**
047: * Creates a new SshFxpData object.
048: *
049: * @param id
050: * @param data
051: */
052: public SshFxpData(UnsignedInteger32 id, byte[] data) {
053: super (SSH_FXP_DATA);
054: this .id = id;
055: this .data = data;
056: }
057:
058: /**
059: * Creates a new SshFxpData object.
060: */
061: public SshFxpData() {
062: super (SSH_FXP_DATA);
063: }
064:
065: /**
066: *
067: *
068: * @return
069: */
070: public UnsignedInteger32 getId() {
071: return id;
072: }
073:
074: /**
075: *
076: *
077: * @return
078: */
079: public byte[] getData() {
080: return data;
081: }
082:
083: /**
084: *
085: *
086: * @param bar
087: *
088: * @throws java.io.IOException
089: * @throws com.sshtools.j2ssh.transport.InvalidMessageException DOCUMENT
090: * ME!
091: */
092: public void constructMessage(ByteArrayReader bar)
093: throws java.io.IOException,
094: com.sshtools.j2ssh.transport.InvalidMessageException {
095: id = bar.readUINT32();
096: data = bar.readBinaryString();
097: }
098:
099: /**
100: *
101: *
102: * @return
103: */
104: public String getMessageName() {
105: return "SSH_FXP_DATA";
106: }
107:
108: /**
109: *
110: *
111: * @param baw
112: *
113: * @throws java.io.IOException
114: * @throws com.sshtools.j2ssh.transport.InvalidMessageException DOCUMENT
115: * ME!
116: */
117: public void constructByteArray(ByteArrayWriter baw)
118: throws java.io.IOException,
119: com.sshtools.j2ssh.transport.InvalidMessageException {
120: baw.writeUINT32(id);
121: baw.writeBinaryString(data);
122: }
123: }
|