コード例 #1
0
ファイル: Request.java プロジェクト: lilac/scribe-java
 public void addFile(String name, String file) throws IOException {
   if (boundary == null) {
     boundary =
         Long.toHexString(System.currentTimeMillis()); // Just generate some unique random value.
   }
   files.put(name, file);
 }
コード例 #2
0
ファイル: Request.java プロジェクト: lilac/scribe-java
 Response doSend() throws IOException {
   connection.setRequestMethod(this.verb.name());
   if (connectTimeout != null) {
     connection.setConnectTimeout(connectTimeout.intValue());
   }
   if (readTimeout != null) {
     connection.setReadTimeout(readTimeout.intValue());
   }
   if (boundary != null) {
     connection.setRequestProperty(CONTENT_TYPE, "multipart/form-data; boundary=" + boundary);
   }
   addHeaders(connection);
   if (verb.equals(Verb.PUT) || verb.equals(Verb.POST)) {
     addBody(connection, getByteBodyContents());
   }
   return new Response(connection);
 }
コード例 #3
0
 void show() { // 打印任务执行的结果
   String result;
   if (connectFinish != 0) result = Long.toString(connectFinish - connectStart) + "ms";
   else if (failure != null) result = failure.toString();
   else result = "Timed out";
   System.out.println(address + " : " + result);
   shown = true;
 }
コード例 #4
0
ファイル: Request.java プロジェクト: rsoika/scribe-java
 Response doSend(RequestTuner tuner) throws IOException
 {
   connection.setRequestMethod(this.verb.name());
   if (connectTimeout != null) 
   {
     connection.setConnectTimeout(connectTimeout.intValue());
   }
   if (readTimeout != null)
   {
     connection.setReadTimeout(readTimeout.intValue());
   }
   tuner.tune(this);
   addHeaders(connection);
   if (verb.equals(Verb.PUT) || verb.equals(Verb.POST))
   {
     addBody(connection, getByteBodyContents());
   }
   return new Response(connection);
 }
コード例 #5
0
ファイル: Token.java プロジェクト: nikhi/basex
 /**
  * Creates a byte array representation from the specified long value, using Java's standard
  * method.
  *
  * @param integer value to be converted
  * @return byte array
  */
 public static byte[] token(final long integer) {
   return integer >= Integer.MIN_VALUE && integer <= Integer.MAX_VALUE
       ? token((int) integer)
       : token(Long.toString(integer));
 }
コード例 #6
0
 @Override
 public int compare(VisorLogFile f1, VisorLogFile f2) {
   return Long.compare(f2.lastModified(), f1.lastModified());
 }
コード例 #7
0
 @Override
 public int compare(Event o1, Event o2) {
   return Long.compare(o1.localOrder(), o2.localOrder());
 }