当前位置: 首页>>代码示例>>Java>>正文


Java TypesWriter.writeBytes方法代码示例

本文整理汇总了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);
}
 
开发者ID:dragonlinux,项目名称:connectbot,代码行数:28,代码来源:SFTPv3Client.java

示例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);
}
 
开发者ID:dragonlinux,项目名称:connectbot,代码行数:30,代码来源:SFTPv3Client.java

示例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);
}
 
开发者ID:jianlinwei,项目名称:sshtunnel,代码行数:32,代码来源:SFTPv3Client.java

示例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);
}
 
开发者ID:jianlinwei,项目名称:sshtunnel,代码行数:31,代码来源:SFTPv3Client.java

示例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());
}
 
开发者ID:dragonlinux,项目名称:connectbot,代码行数:12,代码来源:AuthAgentForwardThread.java

示例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());
}
 
开发者ID:jianlinwei,项目名称:sshtunnel,代码行数:11,代码来源:AuthAgentForwardThread.java

示例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);
}
 
开发者ID:dragonlinux,项目名称:connectbot,代码行数:47,代码来源:SFTPv3Client.java

示例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);
}
 
开发者ID:jianlinwei,项目名称:sshtunnel,代码行数:46,代码来源:SFTPv3Client.java


注:本文中的com.trilead.ssh2.packets.TypesWriter.writeBytes方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。