Source
stringclasses
1 value
Date
int32
2.01k
2.01k
Text
stringlengths
3
15.9M
Token_count
int32
1
2.44M
github-java-corpus
2,012
/* * Copyright (C) 2008 ZXing authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agr...
605
github-java-corpus
2,012
/* * Copyright (C) 2008 ZXing authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agr...
843
github-java-corpus
2,012
/* * Copyright (C) 2010 ZXing authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agr...
289
github-java-corpus
2,012
/* * Copyright (C) 2010 ZXing authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agr...
854
github-java-corpus
2,012
/* * Copyright (C) 2010 ZXing authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agr...
771
github-java-corpus
2,012
/* * Copyright (C) 2010 ZXing authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agr...
657
github-java-corpus
2,012
/* * Copyright (C) 2008 ZXing authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agr...
1,489
github-java-corpus
2,012
/* * Copyright (C) 2008 ZXing authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agr...
622
github-java-corpus
2,012
/* * Copyright (C) 2008 ZXing authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agr...
466
github-java-corpus
2,012
/* * Copyright (C) 2008 ZXing authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agr...
284
github-java-corpus
2,012
/* * Copyright (C) 2008 ZXing authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agr...
414
github-java-corpus
2,012
/* * Copyright (C) 2008 ZXing authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agr...
3,910
github-java-corpus
2,012
/* * Copyright (C) 2008 ZXing authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agr...
621
github-java-corpus
2,012
/* * Copyright (C) 2008 ZXing authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agr...
5,423
github-java-corpus
2,012
/* * Copyright (C) 2008 ZXing authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agr...
718
github-java-corpus
2,012
/* * Copyright (C) 2008 ZXing authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agr...
517
github-java-corpus
2,012
/* * Copyright (C) 2009 ZXing authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agr...
402
github-java-corpus
2,012
/* * Copyright (C) 2008 ZXing authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agr...
2,194
github-java-corpus
2,012
/* * Copyright (C) 2009 ZXing authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agr...
685
github-java-corpus
2,012
/* * Copyright (C) 2011 ZXing authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agr...
532
github-java-corpus
2,012
/* * Copyright (C) 2008 ZXing authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agr...
1,526
github-java-corpus
2,012
/* * Copyright (C) 2008 ZXing authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agr...
361
github-java-corpus
2,012
/* * Copyright (C) 2008 ZXing authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agr...
576
github-java-corpus
2,012
/* * Copyright (C) 2009 ZXing authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agr...
484
github-java-corpus
2,012
/* * Copyright (C) 2008 ZXing authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agr...
400
github-java-corpus
2,012
/* * Copyright (C) 2008 ZXing authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agr...
2,728
github-java-corpus
2,012
/* * Copyright (C) 2010 ZXing authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agr...
752
github-java-corpus
2,012
/* * Copyright (C) 2010 ZXing authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agr...
479
github-java-corpus
2,012
/* * Copyright (C) 2010 ZXing authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agr...
2,415
github-java-corpus
2,012
/* * Copyright (C) 2010 ZXing authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agr...
576
github-java-corpus
2,012
/* * Copyright (C) 2010 ZXing authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agr...
388
github-java-corpus
2,012
/* * Copyright (C) 2010 ZXing authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agr...
272
github-java-corpus
2,012
/* * Copyright (C) 2008 ZXing authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agr...
1,511
github-java-corpus
2,012
/* * Copyright (C) 2010 ZXing authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agr...
861
github-java-corpus
2,012
/* * Copyright (C) 2008 ZXing authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agr...
3,263
github-java-corpus
2,012
/* * Copyright (C) 2008 ZXing authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agr...
1,375
github-java-corpus
2,012
package org.deftserver.io; import static com.google.common.collect.Collections2.transform; import java.io.IOException; import java.nio.channels.ClosedChannelException; import java.nio.channels.SelectableChannel; import java.nio.channels.SelectionKey; import java.nio.channels.Selector; import java.util.Collection; imp...
1,501
github-java-corpus
2,012
package org.deftserver.io; import java.io.IOException; import java.nio.channels.SelectionKey; /** * {@code IOHandler}s are added to the IOLoop via {@link IOLoop#addHandler} method. * The callbacks defined in the {@code IOHandler} will be invoked by the {@code IOLoop} when io is ready. * */ public interface IOHand...
124
github-java-corpus
2,012
package org.deftserver.io.callback; import java.util.AbstractCollection; import java.util.List; import java.util.concurrent.ConcurrentLinkedQueue; import org.deftserver.util.MXBeanUtil; import org.deftserver.web.AsyncCallback; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.google.common.collect....
284
github-java-corpus
2,012
package org.deftserver.io.callback; import org.deftserver.web.AsyncCallback; public interface CallbackManager { void addCallback(AsyncCallback callback); /** * * @return true if there are callbacks scheduled to be executed during the next IO loop iteration. */ boolean execute(); }
63
github-java-corpus
2,012
package org.deftserver.io.callback; import org.deftserver.io.IOLoop; import org.deftserver.io.timeout.Timeout; import org.deftserver.web.AsyncCallback; public class PeriodicCallback { private final IOLoop ioLoop; private final AsyncCallback cb; private final long period; private boolean active = true; /** ...
316
github-java-corpus
2,012
package org.deftserver.io.callback; public interface CallbackManagerMXBean { int getNumberOfCallbacks(); }
22
github-java-corpus
2,012
package org.deftserver.io.timeout; import java.nio.channels.SelectableChannel; import org.deftserver.io.IOLoop; import org.deftserver.util.Closeables; import org.deftserver.web.AsyncCallback; public class Timeout { private final long timeout; private final AsyncCallback cb; private boolean cancelled = false; ...
218
github-java-corpus
2,012
package org.deftserver.io.timeout; import java.nio.channels.SelectableChannel; import java.util.Iterator; import java.util.Map; import org.deftserver.util.MXBeanUtil; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.google.common.collect.Maps; import com.google.common.collect.TreeMultiset; publi...
760
github-java-corpus
2,012
package org.deftserver.io.timeout; import java.nio.channels.SelectableChannel; public interface TimeoutManager { void addTimeout(Timeout timeout); void addKeepAliveTimeout(SelectableChannel channel, Timeout timeout); boolean hasKeepAliveTimeout(SelectableChannel channel); /** * * @return the positive...
87
github-java-corpus
2,012
package org.deftserver.io.timeout; public interface TimeoutManagerMXBean { int getNumberOfTimeouts(); int getNumberOfKeepAliveTimeouts(); }
32
github-java-corpus
2,012
package org.deftserver.io; import java.io.EOFException; import java.io.IOException; import java.net.ConnectException; import java.net.InetSocketAddress; import java.nio.ByteBuffer; import java.nio.channels.SelectableChannel; import java.nio.channels.SelectionKey; import java.nio.channels.ServerSocketChannel; import ja...
2,436
github-java-corpus
2,012
package org.deftserver.io; import java.util.List; public interface IOLoopMXBean { int getNumberOfRegisteredIOHandlers(); List<String> getRegisteredIOHandlers(); }
39
github-java-corpus
2,012
package org.deftserver.io.buffer; import java.nio.ByteBuffer; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.google.common.base.Charsets; public class DynamicByteBuffer { private final static Logger logger = LoggerFactory.getLogger(DynamicByteBuffer.class); private ByteBuffer backend; pr...
777
github-java-corpus
2,012
package org.deftserver.example; import static java.lang.System.out; import org.deftserver.io.IOLoop; import org.deftserver.io.timeout.Timeout; import org.deftserver.web.AsyncCallback; import org.deftserver.web.AsyncResult; import org.deftserver.web.http.client.AsynchronousHttpClient; import org.deftserver.web.http.cl...
221
github-java-corpus
2,012
package org.deftserver.example; import java.util.Map; import org.deftserver.io.IOLoop; import org.deftserver.web.Application; import org.deftserver.web.HttpServer; import org.deftserver.web.handler.RequestHandler; import org.deftserver.web.http.HttpRequest; import org.deftserver.web.http.HttpResponse; import org.slf4...
377
github-java-corpus
2,012
package org.deftserver.example.kv; import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.net.ServerSocket; import java.net.Socket; import java.util.HashMap; import java.util.Map; import org.slf4j.Logge...
568
github-java-corpus
2,012
package org.deftserver.example.kv; import java.io.IOException; import java.net.InetSocketAddress; import java.nio.ByteBuffer; import java.nio.channels.SelectionKey; import java.nio.channels.SocketChannel; import org.deftserver.io.AsynchronousSocket; import org.deftserver.io.IOLoop; import org.deftserver.web.AsyncCall...
357
github-java-corpus
2,012
package org.deftserver.example.kv; import java.util.HashMap; import java.util.Map; import org.deftserver.io.IOLoop; import org.deftserver.web.Application; import org.deftserver.web.AsyncResult; import org.deftserver.web.Asynchronous; import org.deftserver.web.HttpServer; import org.deftserver.web.handler.RequestHandl...
361
github-java-corpus
2,012
package org.deftserver.web.http.client; import java.io.IOException; import java.nio.channels.SocketChannel; import java.util.concurrent.TimeoutException; import org.deftserver.io.AsynchronousSocket; import org.deftserver.io.IOLoop; import org.deftserver.io.timeout.Timeout; import org.deftserver.util.NopAsyncResult; i...
1,923
github-java-corpus
2,012
package org.deftserver.web.http.client; import java.util.Map; import com.google.common.collect.Maps; public class Response { private final long requestTime; private String statusLine; private final Map<String, String> headers = Maps.newHashMap(); private String body = ""; public Response(long requestStarted...
286
github-java-corpus
2,012
package org.deftserver.web.http.client; import java.net.MalformedURLException; import java.net.URL; import org.deftserver.web.HttpVerb; import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class Request { private static final Logger logger = LoggerFactory.getLogger(Request.class); private final URL u...
344
github-java-corpus
2,012
package org.deftserver.web.http; import java.util.Map; /** * Represents an unfinished "dummy" HTTP request, e.g, an HTTP POST request where the entire payload hasn't been * received. * (E.g. because the size of the underlying (OS) socket's read buffer has a fixed size.) * */ public class PartialHttpRequest e...
193
github-java-corpus
2,012
package org.deftserver.web.http; import com.google.common.collect.Maps; public class MalFormedHttpRequest extends HttpRequest { public static final MalFormedHttpRequest instance = new MalFormedHttpRequest(); /* Dummy HttpRequest that represents a malformed client HTTP request */ private MalFormedHttpRequest() ...
83
github-java-corpus
2,012
package org.deftserver.web.http; import java.net.InetAddress; import java.nio.ByteBuffer; import java.util.Collection; import java.util.Collections; import java.util.HashMap; import java.util.Map; import java.util.regex.Pattern; import org.deftserver.io.IOLoop; import org.deftserver.util.ArrayUtil; import org.deftser...
1,879
github-java-corpus
2,012
package org.deftserver.web.http; import static org.deftserver.web.http.HttpServerDescriptor.WRITE_BUFFER_SIZE; import java.io.File; import java.io.IOException; import java.io.RandomAccessFile; import java.nio.MappedByteBuffer; import java.nio.channels.ClosedChannelException; import java.nio.channels.FileChannel; impo...
1,617
github-java-corpus
2,012
package org.deftserver.web.http; /** * This class provides a possiblity to change the tunables used by Deft for the http server configuration. * Do not change the values unless you know what you are doing. */ public class HttpServerDescriptor { /** The number of seconds Deft will wait for subsequent socket activi...
236
github-java-corpus
2,012
package org.deftserver.web.http; public class HttpException extends RuntimeException { private final int statusCode; public HttpException(int statusCode) { this(statusCode, ""); } public HttpException(int statusCode, String message) { super(message); this.statusCode = statusCode; } public int getStat...
72
github-java-corpus
2,012
package org.deftserver.web.http; import static org.deftserver.web.http.HttpServerDescriptor.KEEP_ALIVE_TIMEOUT; import static org.deftserver.web.http.HttpServerDescriptor.READ_BUFFER_SIZE; import java.io.IOException; import java.nio.ByteBuffer; import java.nio.MappedByteBuffer; import java.nio.channels.ClosedChannelE...
1,770
github-java-corpus
2,012
package org.deftserver.web.http; import org.deftserver.web.HttpVerb; import org.deftserver.web.handler.RequestHandler; import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class HttpRequestDispatcher { private static final Logger logger = LoggerFactory.getLogger(HttpRequestDispatcher.class); public sta...
277
github-java-corpus
2,012
package org.deftserver.web; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; import org.deftserver.web.handler.RequestHandler; /** * Annotation used by implementation of {@link RequestHandler} to show tha...
120
github-java-corpus
2,012
package org.deftserver.web; import java.util.Map; import java.util.regex.Pattern; import org.deftserver.util.HttpUtil; import org.deftserver.web.handler.BadRequestRequestHandler; import org.deftserver.web.handler.ForbiddenRequestHandler; import org.deftserver.web.handler.NotFoundRequestHandler; import org.deftserver....
1,064
github-java-corpus
2,012
package org.deftserver.web; public enum HttpVerb { GET, HEAD, POST, PUT, DELETE, OPTIONS, TRACE, CONNECT }
37
github-java-corpus
2,012
package org.deftserver.web; /** * The generic interface a caller must implement to receive an arbitrary callback from an * async call (similar to {@link AsyncResult}). */ public interface AsyncCallback { public static final AsyncCallback nopCb = new AsyncCallback() { @Override public void onCallback() { /*nop*/} ...
74
github-java-corpus
2,012
package org.deftserver.web; /** * The generic interface a caller must implement to receive a result from an * async call */ public interface AsyncResult<T> { /** * The asynchronous call failed to complete normally. * * @param caught failure encountered while executing an async operati...
110
github-java-corpus
2,012
package org.deftserver.web; import java.io.IOException; import java.net.InetSocketAddress; import java.nio.channels.SelectionKey; import java.nio.channels.ServerSocketChannel; import java.util.List; import org.deftserver.io.IOLoop; import org.deftserver.util.Closeables; import org.deftserver.web.http.HttpProtocol; im...
701
github-java-corpus
2,012
package org.deftserver.web; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; import org.deftserver.web.handler.RequestHandler; /** * Annotation used by implementation of {@link RequestHandler} to denote a...
105
github-java-corpus
2,012
package org.deftserver.web.handler; import org.deftserver.web.http.HttpRequest; import org.deftserver.web.http.HttpResponse; public class ForbiddenRequestHandler extends RequestHandler { private final static ForbiddenRequestHandler instance = new ForbiddenRequestHandler(); private ForbiddenRequestHandler() { } ...
115
github-java-corpus
2,012
package org.deftserver.web.handler; import java.lang.annotation.Annotation; import java.util.Map; import org.deftserver.web.Asynchronous; import org.deftserver.web.Authenticated; import org.deftserver.web.HttpVerb; import org.deftserver.web.http.HttpRequest; import org.deftserver.web.http.HttpResponse; import com.go...
508
github-java-corpus
2,012
package org.deftserver.web.handler; import org.deftserver.web.http.HttpRequest; import org.deftserver.web.http.HttpResponse; public class BadRequestRequestHandler extends RequestHandler { private final static BadRequestRequestHandler instance = new BadRequestRequestHandler(); private BadRequestRequestHandler() { ...
125
github-java-corpus
2,012
package org.deftserver.web.handler; import java.io.File; import javax.activation.FileTypeMap; import javax.activation.MimetypesFileTypeMap; import org.deftserver.web.http.HttpException; import org.deftserver.web.http.HttpRequest; import org.deftserver.web.http.HttpResponse; import org.slf4j.Logger; import org.slf4j....
579
github-java-corpus
2,012
package org.deftserver.web.handler; import org.deftserver.web.http.HttpRequest; import org.deftserver.web.http.HttpResponse; public class NotFoundRequestHandler extends RequestHandler { private final static NotFoundRequestHandler instance = new NotFoundRequestHandler(); private NotFoundRequestHandler() { } p...
129
github-java-corpus
2,012
package org.deftserver.util; public class Pair<T1, T2> { public final T1 _1; public final T2 _2; public Pair(T1 first, T2 second) { this._1 = first; this._2 = second; } public static <X, Y> Pair<X, Y> of(X _1, Y _2) { return new Pair<X, Y>(_1, _2); } }
98
github-java-corpus
2,012
package org.deftserver.util; public class ArrayUtil { // private static final List<String> EMPTY_STRING_LIST = Arrays.asList(""); // private static final String[] EMPTY_STRING_ARRAY = new String[0]; public static String[] dropFromEndWhile(String[] array, String regex) { for (int i = array.length - 1 ;i >= 0; i--)...
185
github-java-corpus
2,012
package org.deftserver.util; import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Date; import java.util.Locale; import java.util.TimeZone; public class DateUtil { private final static Locale LOCALE = Locale.US; private final static TimeZone GMT_ZONE; private final static String RFC_11...
159
github-java-corpus
2,012
package org.deftserver.util; import java.io.IOException; import java.nio.channels.SelectableChannel; import org.deftserver.io.IOLoop; public class Closeables { private Closeables() {} public static void closeQuietly(SelectableChannel channel) { closeQuietly(IOLoop.INSTANCE, channel); } public static void c...
120
github-java-corpus
2,012
package org.deftserver.util; import java.lang.management.ManagementFactory; import javax.management.MBeanServer; import javax.management.ObjectName; import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class MXBeanUtil { private static final Logger logger = LoggerFactory.getLogger(MXBeanUtil.class); ...
177
github-java-corpus
2,012
package org.deftserver.util; import java.net.MalformedURLException; import java.net.URL; public class UrlUtil { /** Example: * <pre> * {@code * url: http://tt.se/ Location: /start => http://tt.se/start * url: http://localhost/moved_perm Location: / => htt...
216
github-java-corpus
2,012
package org.deftserver.util; import java.io.IOException; import java.nio.channels.SelectionKey; import java.nio.channels.ServerSocketChannel; import org.deftserver.io.IOHandler; import org.deftserver.io.IOLoop; import org.deftserver.web.AsyncCallback; public class AcceptUtil { public static void accept(ServerSocke...
211
github-java-corpus
2,012
package org.deftserver.util; import java.io.File; import java.math.BigInteger; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import org.deftserver.web.http.HttpRequest; import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class HttpUtil { private static final Logger...
1,879
github-java-corpus
2,012
package org.deftserver.util; import org.deftserver.web.AsyncResult; /** * Convenience class used to limit the Java verboseness. */ public class NopAsyncResult<T> { private NopAsyncResult() {} public final AsyncResult<T> nopAsyncResult = new AsyncResult<T>() { @Override public void onFailure(Throwable caugh...
114
github-java-corpus
2,012
package org.deftserver.io; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; import java.io.DataInputStream; import java.io.DataOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.net.ServerSocket; import java.net.Socket;...
880
github-java-corpus
2,012
package org.deftserver.io.callback; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; import java.util.concurrent.CountDownLatch; import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.TimeUnit; import org.deftser...
625
github-java-corpus
2,012
package org.deftserver.io.callback; import static org.junit.Assert.assertEquals; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; import org.deftserver.io.IOLoop; import org.deftserver.web.AsyncCallback; import org.junit.Test; public class PeriodicCallbackTest { @Test public voi...
257
github-java-corpus
2,012
package org.deftserver.io.timeout; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; import org.deftserver.web.AsyncCallback; import org.junit.Test; public class TimeoutTest { @Test public void simpleTimeoutConstructorTest() { final AsyncCallback cb = new AsyncCallback() { ...
201
github-java-corpus
2,012
package org.deftserver.io.timeout; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; import java.io.IOException; import java.nio.channels.ClosedChannelException; import java.nio.channels.SelectableChannel; import java.nio.channels.SelectionKey; import java.nio.channels.Selector; ...
978
github-java-corpus
2,012
package org.deftserver.io.buffer; import static org.junit.Assert.assertEquals; import org.junit.Before; import org.junit.Test; public class DynamicByteBufferTest { private DynamicByteBuffer dbb; private static final int INITIAL_CAPACITY = 10; // bytes @Before public void allocation() { this.dbb = DynamicByt...
639
github-java-corpus
2,012
package org.deftserver.web.http; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; import java.nio.ByteBuffer; import java.util.ArrayList; import java.util.Arrays; import java.util.Collectio...
2,815
github-java-corpus
2,012
package org.deftserver.web; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; import java.io.BufferedReader; import java.io.File; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.ne...
10,790
github-java-corpus
2,012
package org.deftserver.web; import org.deftserver.web.handler.RequestHandler; import org.junit.Test; import com.google.common.collect.Maps; public class HttpServerTest { private final Application application = new Application(Maps.<String, RequestHandler>newHashMap()); @Test(expected=IllegalArgumentException....
171
github-java-corpus
2,012
package org.deftserver.web; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import java.util.HashMap; import java.util.Map; import java.util.regex.PatternSyntaxException; import org.deftserver.web.handler.BadRequestRequestHandler; import org.deftserver.web.handler.NotFoundR...
1,038
github-java-corpus
2,012
package org.deftserver.web.handler; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; import org.deftserver.web.Asynchronous; import org.deftserver.web.Authenticated; import org.deftserver.web.HttpVerb; import org.deftserver.web.handler.RequestHandler; import org.deftserver.web.ht...
370
github-java-corpus
2,012
package org.deftserver.util; import java.nio.ByteBuffer; import java.util.Collection; import java.util.HashMap; import java.util.Map; import com.google.common.collect.HashMultimap; import com.google.common.collect.Multimap; /** * This class can be used to create HttpRequests (and corresponding byte representations)...
952
github-java-corpus
2,012
package org.deftserver.util; import static org.junit.Assert.assertEquals; import java.net.MalformedURLException; import java.net.URL; import org.junit.Test; public class UrlUtilTest { @Test public void urlJoinTest() throws MalformedURLException { assertEquals("http://tt.se/start/", UrlUtil.urlJoin(new URL("htt...
133
github-java-corpus
2,012
package com.stylingandroid.presenterlite; import com.stylingandroid.presenterlite.presentation.DisplayLayout; import android.os.Bundle; import android.os.PowerManager; import android.os.PowerManager.WakeLock; import android.support.v4.app.FragmentActivity; import android.view.MotionEvent; import android.view...
282