本文整理汇总了Java中org.eclipse.jgit.transport.PacketLineIn类的典型用法代码示例。如果您正苦于以下问题:Java PacketLineIn类的具体用法?Java PacketLineIn怎么用?Java PacketLineIn使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PacketLineIn类属于org.eclipse.jgit.transport包,在下文中一共展示了PacketLineIn类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: archiveNotPermitted
import org.eclipse.jgit.transport.PacketLineIn; //导入依赖的package包/类
private void archiveNotPermitted() throws Exception {
PushOneCommit.Result r = createChange();
String abbreviated = r.getCommit().abbreviate(8).name();
String c = command(r, abbreviated);
InputStream out =
adminSshSession.exec2("git-upload-archive " + project.get(), argumentsToInputStream(c));
// Wrap with PacketLineIn to read ACK bytes from output stream
PacketLineIn in = new PacketLineIn(out);
String tmp = in.readString();
assertThat(tmp).isEqualTo("ACK");
tmp = in.readString();
tmp = in.readString();
tmp = tmp.substring(1);
assertThat(tmp).isEqualTo("fatal: upload-archive not permitted");
}
示例2: execute
import org.eclipse.jgit.transport.PacketLineIn; //导入依赖的package包/类
void execute(final Socket sock) throws IOException,
ServiceNotEnabledException, ServiceNotAuthorizedException {
rawIn = new BufferedInputStream(sock.getInputStream());
rawOut = new SafeBufferedOutputStream(sock.getOutputStream());
if (0 < daemon.getTimeout())
sock.setSoTimeout(daemon.getTimeout() * 1000);
String cmd = new PacketLineIn(rawIn).readStringRaw();
final int nul = cmd.indexOf('\0');
if (nul >= 0) {
// Newer clients hide a "host" header behind this byte.
// Currently we don't use it for anything, so we ignore
// this portion of the command.
//
cmd = cmd.substring(0, nul);
}
final GitDaemonService srv = getDaemon().matchService(cmd);
if (srv == null)
return;
sock.setSoTimeout(0);
srv.execute(this, cmd);
}
示例3: readArguments
import org.eclipse.jgit.transport.PacketLineIn; //导入依赖的package包/类
/**
* Read and parse arguments from input stream. This method gets the arguments from input stream,
* in Pkt-line format, then parses them to fill the options object.
*/
protected void readArguments() throws IOException, Failure {
String argCmd = "argument ";
List<String> args = new ArrayList<>();
// Read arguments in Pkt-Line format
PacketLineIn packetIn = new PacketLineIn(in);
for (; ; ) {
String s = packetIn.readString();
if (s == PacketLineIn.END) {
break;
}
if (!s.startsWith(argCmd)) {
throw new Failure(1, "fatal: 'argument' token or flush expected");
}
String[] parts = s.substring(argCmd.length()).split("=", 2);
for (String p : parts) {
args.add(p);
}
}
try {
// Parse them into the 'options' field
CmdLineParser parser = new CmdLineParser(options);
parser.parseArgument(args);
if (options.path == null || Arrays.asList(".").equals(options.path)) {
options.path = Collections.emptyList();
}
} catch (CmdLineException e) {
throw new Failure(2, "fatal: unable to parse arguments, " + e);
}
}
示例4: execute
import org.eclipse.jgit.transport.PacketLineIn; //导入依赖的package包/类
void execute(final Socket sock) throws IOException,
ServiceNotEnabledException, ServiceNotAuthorizedException {
rawIn = new BufferedInputStream(sock.getInputStream());
rawOut = new SafeBufferedOutputStream(sock.getOutputStream());
if (0 < daemon.getTimeout()) {
sock.setSoTimeout(daemon.getTimeout() * 1000);
}
String cmd = new PacketLineIn(rawIn).readStringRaw();
final int nul = cmd.indexOf('\0');
if (nul >= 0) {
// Newer clients hide a "host" header behind this byte.
// Currently we don't use it for anything, so we ignore
// this portion of the command.
//
cmd = cmd.substring(0,
nul);
}
final DaemonService srv = getDaemon().matchService(cmd);
if (srv == null) {
return;
}
sock.setSoTimeout(0);
srv.execute(this,
cmd);
}