當前位置: 首頁>>代碼示例>>Java>>正文


Java PacketLineIn類代碼示例

本文整理匯總了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");
}
 
開發者ID:gerrit-review,項目名稱:gerrit,代碼行數:18,代碼來源:UploadArchiveIT.java

示例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);
}
 
開發者ID:warpfork,項目名稱:gitblit,代碼行數:24,代碼來源:GitDaemonClient.java

示例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);
  }
}
 
開發者ID:gerrit-review,項目名稱:gerrit,代碼行數:36,代碼來源:UploadArchive.java

示例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);
}
 
開發者ID:kiegroup,項目名稱:appformer,代碼行數:28,代碼來源:DaemonClient.java


注:本文中的org.eclipse.jgit.transport.PacketLineIn類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。