本文整理汇总了Java中com.trilead.ssh2.packets.TypesWriter.writeBytes方法的典型用法代码示例。如果您正苦于以下问题:Java TypesWriter.writeBytes方法的具体用法?Java TypesWriter.writeBytes怎么用?Java TypesWriter.writeBytes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.trilead.ssh2.packets.TypesWriter
的用法示例。
在下文中一共展示了TypesWriter.writeBytes方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setstat
import com.trilead.ssh2.packets.TypesWriter; //导入方法依赖的package包/类
/**
* Modify the attributes of a file. Used for operations such as changing
* the ownership, permissions or access times, as well as for truncating a file.
*
* @param path See the {@link SFTPv3Client comment} for the class for more details.
* @param attr A SFTPv3FileAttributes object. Specifies the modifications to be
* made to the attributes of the file. Empty fields will be ignored.
* @throws IOException
*/
public void setstat(String path, SFTPv3FileAttributes attr) throws IOException
{
int req_id = generateNextRequestID();
TypesWriter tw = new TypesWriter();
tw.writeString(path, charsetName);
tw.writeBytes(createAttrs(attr));
if (debug != null)
{
debug.println("Sending SSH_FXP_SETSTAT...");
debug.flush();
}
sendMessage(Packet.SSH_FXP_SETSTAT, req_id, tw.getBytes());
expectStatusOKMessage(req_id);
}
示例2: fsetstat
import com.trilead.ssh2.packets.TypesWriter; //导入方法依赖的package包/类
/**
* Modify the attributes of a file. Used for operations such as changing
* the ownership, permissions or access times, as well as for truncating a file.
*
* @param handle a SFTPv3FileHandle handle
* @param attr A SFTPv3FileAttributes object. Specifies the modifications to be
* made to the attributes of the file. Empty fields will be ignored.
* @throws IOException
*/
public void fsetstat(SFTPv3FileHandle handle, SFTPv3FileAttributes attr) throws IOException
{
checkHandleValidAndOpen(handle);
int req_id = generateNextRequestID();
TypesWriter tw = new TypesWriter();
tw.writeString(handle.fileHandle, 0, handle.fileHandle.length);
tw.writeBytes(createAttrs(attr));
if (debug != null)
{
debug.println("Sending SSH_FXP_FSETSTAT...");
debug.flush();
}
sendMessage(Packet.SSH_FXP_FSETSTAT, req_id, tw.getBytes());
expectStatusOKMessage(req_id);
}
示例3: fsetstat
import com.trilead.ssh2.packets.TypesWriter; //导入方法依赖的package包/类
/**
* Modify the attributes of a file. Used for operations such as changing the
* ownership, permissions or access times, as well as for truncating a file.
*
* @param handle
* a SFTPv3FileHandle handle
* @param attr
* A SFTPv3FileAttributes object. Specifies the modifications to
* be made to the attributes of the file. Empty fields will be
* ignored.
* @throws IOException
*/
public void fsetstat(SFTPv3FileHandle handle, SFTPv3FileAttributes attr)
throws IOException {
checkHandleValidAndOpen(handle);
int req_id = generateNextRequestID();
TypesWriter tw = new TypesWriter();
tw.writeString(handle.fileHandle, 0, handle.fileHandle.length);
tw.writeBytes(createAttrs(attr));
if (debug != null) {
debug.println("Sending SSH_FXP_FSETSTAT...");
debug.flush();
}
sendMessage(Packet.SSH_FXP_FSETSTAT, req_id, tw.getBytes());
expectStatusOKMessage(req_id);
}
示例4: setstat
import com.trilead.ssh2.packets.TypesWriter; //导入方法依赖的package包/类
/**
* Modify the attributes of a file. Used for operations such as changing the
* ownership, permissions or access times, as well as for truncating a file.
*
* @param path
* See the {@link SFTPv3Client comment} for the class for more
* details.
* @param attr
* A SFTPv3FileAttributes object. Specifies the modifications to
* be made to the attributes of the file. Empty fields will be
* ignored.
* @throws IOException
*/
public void setstat(String path, SFTPv3FileAttributes attr)
throws IOException {
int req_id = generateNextRequestID();
TypesWriter tw = new TypesWriter();
tw.writeString(path, charsetName);
tw.writeBytes(createAttrs(attr));
if (debug != null) {
debug.println("Sending SSH_FXP_SETSTAT...");
debug.flush();
}
sendMessage(Packet.SSH_FXP_SETSTAT, req_id, tw.getBytes());
expectStatusOKMessage(req_id);
}
示例5: sendPacket
import com.trilead.ssh2.packets.TypesWriter; //导入方法依赖的package包/类
/**
* @param tw
* @throws IOException
*/
private void sendPacket(byte[] message) throws IOException
{
TypesWriter packet = new TypesWriter();
packet.writeUINT32(message.length);
packet.writeBytes(message);
os.write(packet.getBytes());
}
示例6: sendPacket
import com.trilead.ssh2.packets.TypesWriter; //导入方法依赖的package包/类
/**
* @param tw
* @throws IOException
*/
private void sendPacket(byte[] message) throws IOException {
TypesWriter packet = new TypesWriter();
packet.writeUINT32(message.length);
packet.writeBytes(message);
os.write(packet.getBytes());
}
示例7: openFile
import com.trilead.ssh2.packets.TypesWriter; //导入方法依赖的package包/类
private SFTPv3FileHandle openFile(String fileName, int flags, SFTPv3FileAttributes attr) throws IOException
{
int req_id = generateNextRequestID();
TypesWriter tw = new TypesWriter();
tw.writeString(fileName, charsetName);
tw.writeUINT32(flags);
tw.writeBytes(createAttrs(attr));
if (debug != null)
{
debug.println("Sending SSH_FXP_OPEN...");
debug.flush();
}
sendMessage(Packet.SSH_FXP_OPEN, req_id, tw.getBytes());
byte[] resp = receiveMessage(34000);
TypesReader tr = new TypesReader(resp);
int t = tr.readByte();
int rep_id = tr.readUINT32();
if (rep_id != req_id)
throw new IOException("The server sent an invalid id field.");
if (t == Packet.SSH_FXP_HANDLE)
{
if (debug != null)
{
debug.println("Got SSH_FXP_HANDLE.");
debug.flush();
}
return new SFTPv3FileHandle(this, tr.readByteString());
}
if (t != Packet.SSH_FXP_STATUS)
throw new IOException("The SFTP server sent an unexpected packet type (" + t + ")");
int errorCode = tr.readUINT32();
String errorMessage = tr.readString();
throw new SFTPException(errorMessage, errorCode);
}
示例8: openFile
import com.trilead.ssh2.packets.TypesWriter; //导入方法依赖的package包/类
private SFTPv3FileHandle openFile(String fileName, int flags,
SFTPv3FileAttributes attr) throws IOException {
int req_id = generateNextRequestID();
TypesWriter tw = new TypesWriter();
tw.writeString(fileName, charsetName);
tw.writeUINT32(flags);
tw.writeBytes(createAttrs(attr));
if (debug != null) {
debug.println("Sending SSH_FXP_OPEN...");
debug.flush();
}
sendMessage(Packet.SSH_FXP_OPEN, req_id, tw.getBytes());
byte[] resp = receiveMessage(34000);
TypesReader tr = new TypesReader(resp);
int t = tr.readByte();
int rep_id = tr.readUINT32();
if (rep_id != req_id)
throw new IOException("The server sent an invalid id field.");
if (t == Packet.SSH_FXP_HANDLE) {
if (debug != null) {
debug.println("Got SSH_FXP_HANDLE.");
debug.flush();
}
return new SFTPv3FileHandle(this, tr.readByteString());
}
if (t != Packet.SSH_FXP_STATUS)
throw new IOException(
"The SFTP server sent an unexpected packet type (" + t
+ ")");
int errorCode = tr.readUINT32();
String errorMessage = tr.readString();
throw new SFTPException(errorMessage, errorCode);
}