id
int32
0
165k
repo
stringlengths
7
58
path
stringlengths
12
218
func_name
stringlengths
3
140
original_string
stringlengths
73
34.1k
language
stringclasses
1 value
code
stringlengths
73
34.1k
code_tokens
list
docstring
stringlengths
3
16k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
105
339
3,600
twitter/cloudhopper-commons
ch-commons-gsm/src/main/java/com/cloudhopper/commons/gsm/DataCoding.java
DataCoding.createCharacterEncodingGroup
static public DataCoding createCharacterEncodingGroup(byte characterEncoding) throws IllegalArgumentException { // bits 3 thru 0 of the encoding represent 16 languages // make sure the top bits 7 thru 4 are not set if ((characterEncoding & 0xF0) != 0) { throw new IllegalArgumentExcep...
java
static public DataCoding createCharacterEncodingGroup(byte characterEncoding) throws IllegalArgumentException { // bits 3 thru 0 of the encoding represent 16 languages // make sure the top bits 7 thru 4 are not set if ((characterEncoding & 0xF0) != 0) { throw new IllegalArgumentExcep...
[ "static", "public", "DataCoding", "createCharacterEncodingGroup", "(", "byte", "characterEncoding", ")", "throws", "IllegalArgumentException", "{", "// bits 3 thru 0 of the encoding represent 16 languages", "// make sure the top bits 7 thru 4 are not set", "if", "(", "(", "characterE...
Creates a "Character Encoding" group data coding scheme where 16 different languages are supported. This method validates the range and sets the message class to 0 and compression flags to false. @param characterEncoding The different possible character encodings @return A new immutable DataCoding instance representin...
[ "Creates", "a", "Character", "Encoding", "group", "data", "coding", "scheme", "where", "16", "different", "languages", "are", "supported", ".", "This", "method", "validates", "the", "range", "and", "sets", "the", "message", "class", "to", "0", "and", "compress...
b5bc397dbec4537e8149e7ec0733c1d7ed477499
https://github.com/twitter/cloudhopper-commons/blob/b5bc397dbec4537e8149e7ec0733c1d7ed477499/ch-commons-gsm/src/main/java/com/cloudhopper/commons/gsm/DataCoding.java#L202-L209
3,601
twitter/cloudhopper-commons
ch-commons-gsm/src/main/java/com/cloudhopper/commons/gsm/DataCoding.java
DataCoding.parse
static public DataCoding parse(byte dcs) { try { // if bits 7 thru 4 are all off, this represents a simple character encoding group if ((dcs & (byte)0xF0) == 0x00) { // the raw dcs value is exactly our 16 possible languaged return createCharacterEncodingGr...
java
static public DataCoding parse(byte dcs) { try { // if bits 7 thru 4 are all off, this represents a simple character encoding group if ((dcs & (byte)0xF0) == 0x00) { // the raw dcs value is exactly our 16 possible languaged return createCharacterEncodingGr...
[ "static", "public", "DataCoding", "parse", "(", "byte", "dcs", ")", "{", "try", "{", "// if bits 7 thru 4 are all off, this represents a simple character encoding group", "if", "(", "(", "dcs", "&", "(", "byte", ")", "0xF0", ")", "==", "0x00", ")", "{", "// the ra...
Parse the data coding scheme value into something usable and makes various values easy to use. If a "reserved" value is used, returns a data coding representing the same byte value, but all properties to their defaults. @param dcs The byte value of the data coding scheme @return A new immutable DataCoding instance rep...
[ "Parse", "the", "data", "coding", "scheme", "value", "into", "something", "usable", "and", "makes", "various", "values", "easy", "to", "use", ".", "If", "a", "reserved", "value", "is", "used", "returns", "a", "data", "coding", "representing", "the", "same", ...
b5bc397dbec4537e8149e7ec0733c1d7ed477499
https://github.com/twitter/cloudhopper-commons/blob/b5bc397dbec4537e8149e7ec0733c1d7ed477499/ch-commons-gsm/src/main/java/com/cloudhopper/commons/gsm/DataCoding.java#L343-L418
3,602
twitter/cloudhopper-commons
ch-commons-util/src/main/java/com/cloudhopper/commons/util/ByteBuffer.java
ByteBuffer.circularByteBufferInitializer
private void circularByteBufferInitializer(int bufferCapacity, int bufferSize, int readPosition, int writePosition) { if (bufferCapacity < 2) { throw new IllegalArgumentException("Buffer capacity must be greater than 2 !"); } if ((bufferSize < 0) || (bufferSize > bufferCapacity)) { ...
java
private void circularByteBufferInitializer(int bufferCapacity, int bufferSize, int readPosition, int writePosition) { if (bufferCapacity < 2) { throw new IllegalArgumentException("Buffer capacity must be greater than 2 !"); } if ((bufferSize < 0) || (bufferSize > bufferCapacity)) { ...
[ "private", "void", "circularByteBufferInitializer", "(", "int", "bufferCapacity", ",", "int", "bufferSize", ",", "int", "readPosition", ",", "int", "writePosition", ")", "{", "if", "(", "bufferCapacity", "<", "2", ")", "{", "throw", "new", "IllegalArgumentExceptio...
Intializes the new CircularByteBuffer with all parameters that characterize a CircularByteBuffer. @param bufferCapacity the buffer capacity. Must be >= 2. @param bufferSize the buffer initial size. Must be in [0, bufferCapacity]. @param readPosition the buffer initial read position. Must be in [0, bufferSize] @param wr...
[ "Intializes", "the", "new", "CircularByteBuffer", "with", "all", "parameters", "that", "characterize", "a", "CircularByteBuffer", "." ]
b5bc397dbec4537e8149e7ec0733c1d7ed477499
https://github.com/twitter/cloudhopper-commons/blob/b5bc397dbec4537e8149e7ec0733c1d7ed477499/ch-commons-util/src/main/java/com/cloudhopper/commons/util/ByteBuffer.java#L243-L260
3,603
twitter/cloudhopper-commons
ch-commons-util/src/main/java/com/cloudhopper/commons/util/ByteBuffer.java
ByteBuffer.modularExponentation
private int modularExponentation(int a, int b, int n) throws IllegalArgumentException { int result = 1; int counter; int maxBinarySize = 32; boolean[] b2Binary = new boolean[maxBinarySize]; for (counter = 0; b > 0; counter++) { if (counter >= maxBinarySize){ ...
java
private int modularExponentation(int a, int b, int n) throws IllegalArgumentException { int result = 1; int counter; int maxBinarySize = 32; boolean[] b2Binary = new boolean[maxBinarySize]; for (counter = 0; b > 0; counter++) { if (counter >= maxBinarySize){ ...
[ "private", "int", "modularExponentation", "(", "int", "a", ",", "int", "b", ",", "int", "n", ")", "throws", "IllegalArgumentException", "{", "int", "result", "=", "1", ";", "int", "counter", ";", "int", "maxBinarySize", "=", "32", ";", "boolean", "[", "]...
Gets the modular exponentiation, i.e. result of a^b mod n. Use to calculate hashcode. @param a A number. @param b An exponent. @param n A modulus. @return Result of modular exponentiation, i.e. result of a^b mod n.
[ "Gets", "the", "modular", "exponentiation", "i", ".", "e", ".", "result", "of", "a^b", "mod", "n", ".", "Use", "to", "calculate", "hashcode", "." ]
b5bc397dbec4537e8149e7ec0733c1d7ed477499
https://github.com/twitter/cloudhopper-commons/blob/b5bc397dbec4537e8149e7ec0733c1d7ed477499/ch-commons-util/src/main/java/com/cloudhopper/commons/util/ByteBuffer.java#L270-L289
3,604
twitter/cloudhopper-commons
ch-commons-util/src/main/java/com/cloudhopper/commons/util/ByteBuffer.java
ByteBuffer.add
public void add(byte b) throws BufferIsFullException { if (isFull()) { throw new BufferIsFullException("Buffer is full and has reached maximum capacity (" + capacity() + ")"); } // buffer is not full this.buffer[this.currentWritePosition] = b; this.currentWritePositi...
java
public void add(byte b) throws BufferIsFullException { if (isFull()) { throw new BufferIsFullException("Buffer is full and has reached maximum capacity (" + capacity() + ")"); } // buffer is not full this.buffer[this.currentWritePosition] = b; this.currentWritePositi...
[ "public", "void", "add", "(", "byte", "b", ")", "throws", "BufferIsFullException", "{", "if", "(", "isFull", "(", ")", ")", "{", "throw", "new", "BufferIsFullException", "(", "\"Buffer is full and has reached maximum capacity (\"", "+", "capacity", "(", ")", "+", ...
Adds one byte to the buffer and throws an exception if the buffer is full. @param b Byte to add to the buffer. @throws BufferIsFullException If the buffer is full and the byte cannot be stored.
[ "Adds", "one", "byte", "to", "the", "buffer", "and", "throws", "an", "exception", "if", "the", "buffer", "is", "full", "." ]
b5bc397dbec4537e8149e7ec0733c1d7ed477499
https://github.com/twitter/cloudhopper-commons/blob/b5bc397dbec4537e8149e7ec0733c1d7ed477499/ch-commons-util/src/main/java/com/cloudhopper/commons/util/ByteBuffer.java#L366-L375
3,605
twitter/cloudhopper-commons
ch-commons-util/src/main/java/com/cloudhopper/commons/util/ByteBuffer.java
ByteBuffer.checkOffsetLength
static protected void checkOffsetLength(int bytesLength, int offset, int length) throws IllegalArgumentException { // offset cannot be negative if (offset < 0) { throw new IllegalArgumentException("The byte[] offset parameter cannot be negative"); } // length cann...
java
static protected void checkOffsetLength(int bytesLength, int offset, int length) throws IllegalArgumentException { // offset cannot be negative if (offset < 0) { throw new IllegalArgumentException("The byte[] offset parameter cannot be negative"); } // length cann...
[ "static", "protected", "void", "checkOffsetLength", "(", "int", "bytesLength", ",", "int", "offset", ",", "int", "length", ")", "throws", "IllegalArgumentException", "{", "// offset cannot be negative", "if", "(", "offset", "<", "0", ")", "{", "throw", "new", "I...
Helper method for validating if an offset and length are valid for a given byte array. Checks if the offset or length is negative or if the offset+length would cause a read past the end of the byte array. @param bytesLength The length of the byte array to validate against @param offset The offset within the byte array ...
[ "Helper", "method", "for", "validating", "if", "an", "offset", "and", "length", "are", "valid", "for", "a", "given", "byte", "array", ".", "Checks", "if", "the", "offset", "or", "length", "is", "negative", "or", "if", "the", "offset", "+", "length", "wou...
b5bc397dbec4537e8149e7ec0733c1d7ed477499
https://github.com/twitter/cloudhopper-commons/blob/b5bc397dbec4537e8149e7ec0733c1d7ed477499/ch-commons-util/src/main/java/com/cloudhopper/commons/util/ByteBuffer.java#L400-L419
3,606
twitter/cloudhopper-commons
ch-commons-util/src/main/java/com/cloudhopper/commons/util/ByteBuffer.java
ByteBuffer.add
public void add(byte[] bytes, int offset, int length) throws IllegalArgumentException, BufferSizeException { // validate the bytes, offset, length checkOffsetLength(bytes.length, offset, length); // is there enough free space in this buffer to add the entire array if (length ...
java
public void add(byte[] bytes, int offset, int length) throws IllegalArgumentException, BufferSizeException { // validate the bytes, offset, length checkOffsetLength(bytes.length, offset, length); // is there enough free space in this buffer to add the entire array if (length ...
[ "public", "void", "add", "(", "byte", "[", "]", "bytes", ",", "int", "offset", ",", "int", "length", ")", "throws", "IllegalArgumentException", ",", "BufferSizeException", "{", "// validate the bytes, offset, length", "checkOffsetLength", "(", "bytes", ".", "length"...
Adds a byte array to this buffer starting from the offset up to the length requested. If the free space remaining in the buffer is not large enough, this method will throw a BufferSizeException. @param bytes A byte array to add to this buffer. @param offset The offset within the byte array to begin to add @param length...
[ "Adds", "a", "byte", "array", "to", "this", "buffer", "starting", "from", "the", "offset", "up", "to", "the", "length", "requested", ".", "If", "the", "free", "space", "remaining", "in", "the", "buffer", "is", "not", "large", "enough", "this", "method", ...
b5bc397dbec4537e8149e7ec0733c1d7ed477499
https://github.com/twitter/cloudhopper-commons/blob/b5bc397dbec4537e8149e7ec0733c1d7ed477499/ch-commons-util/src/main/java/com/cloudhopper/commons/util/ByteBuffer.java#L430-L449
3,607
twitter/cloudhopper-commons
ch-commons-util/src/main/java/com/cloudhopper/commons/util/ByteBuffer.java
ByteBuffer.get
public byte get(int index) throws IllegalArgumentException, BufferSizeException { if ((index < 0) || (index >= capacity())) { throw new IllegalArgumentException("The buffer index must be a value between 0 and " + capacity() + "!"); } if (index >= size()) { throw new Buff...
java
public byte get(int index) throws IllegalArgumentException, BufferSizeException { if ((index < 0) || (index >= capacity())) { throw new IllegalArgumentException("The buffer index must be a value between 0 and " + capacity() + "!"); } if (index >= size()) { throw new Buff...
[ "public", "byte", "get", "(", "int", "index", ")", "throws", "IllegalArgumentException", ",", "BufferSizeException", "{", "if", "(", "(", "index", "<", "0", ")", "||", "(", "index", ">=", "capacity", "(", ")", ")", ")", "{", "throw", "new", "IllegalArgum...
Gets the byte at the given index relative to the beginning the circular buffer. The index must be a value between 0 and the buffer capacity. @param index The index of the byte relative to the beginning the buffer (a value between 0 and the the current size). @return The byte at the given position relative to the beginn...
[ "Gets", "the", "byte", "at", "the", "given", "index", "relative", "to", "the", "beginning", "the", "circular", "buffer", ".", "The", "index", "must", "be", "a", "value", "between", "0", "and", "the", "buffer", "capacity", "." ]
b5bc397dbec4537e8149e7ec0733c1d7ed477499
https://github.com/twitter/cloudhopper-commons/blob/b5bc397dbec4537e8149e7ec0733c1d7ed477499/ch-commons-util/src/main/java/com/cloudhopper/commons/util/ByteBuffer.java#L708-L716
3,608
twitter/cloudhopper-commons
ch-commons-util/src/main/java/com/cloudhopper/commons/util/ByteBuffer.java
ByteBuffer.toArray
public void toArray(int offset, int length, byte[] targetBuffer, int targetOffset) { // validate the offset, length are ok ByteBuffer.checkOffsetLength(size(), offset, length); // validate the offset, length are ok ByteBuffer.checkOffsetLength(targetBuffer.length, targetOffset, length)...
java
public void toArray(int offset, int length, byte[] targetBuffer, int targetOffset) { // validate the offset, length are ok ByteBuffer.checkOffsetLength(size(), offset, length); // validate the offset, length are ok ByteBuffer.checkOffsetLength(targetBuffer.length, targetOffset, length)...
[ "public", "void", "toArray", "(", "int", "offset", ",", "int", "length", ",", "byte", "[", "]", "targetBuffer", ",", "int", "targetOffset", ")", "{", "// validate the offset, length are ok", "ByteBuffer", ".", "checkOffsetLength", "(", "size", "(", ")", ",", "...
Will copy data from this ByteBuffer's buffer into the targetBuffer. This method requires the targetBuffer to already be allocated with enough capacity to hold this ByteBuffer's data. @param offset The offset within the ByteBuffer to start copy from @param length The length from the offset to copy @param targetBuffer T...
[ "Will", "copy", "data", "from", "this", "ByteBuffer", "s", "buffer", "into", "the", "targetBuffer", ".", "This", "method", "requires", "the", "targetBuffer", "to", "already", "be", "allocated", "with", "enough", "capacity", "to", "hold", "this", "ByteBuffer", ...
b5bc397dbec4537e8149e7ec0733c1d7ed477499
https://github.com/twitter/cloudhopper-commons/blob/b5bc397dbec4537e8149e7ec0733c1d7ed477499/ch-commons-util/src/main/java/com/cloudhopper/commons/util/ByteBuffer.java#L804-L847
3,609
twitter/cloudhopper-commons
ch-commons-util/src/main/java/com/cloudhopper/commons/util/ByteBuffer.java
ByteBuffer.startsWith
public boolean startsWith(byte[] prefix) { if ((prefix.length == 0) || (prefix.length > size())) { // no match would be possible return false; } boolean match = true; int i = 0; int j = this.currentReadPosition; while (match && (i < prefix.length))...
java
public boolean startsWith(byte[] prefix) { if ((prefix.length == 0) || (prefix.length > size())) { // no match would be possible return false; } boolean match = true; int i = 0; int j = this.currentReadPosition; while (match && (i < prefix.length))...
[ "public", "boolean", "startsWith", "(", "byte", "[", "]", "prefix", ")", "{", "if", "(", "(", "prefix", ".", "length", "==", "0", ")", "||", "(", "prefix", ".", "length", ">", "size", "(", ")", ")", ")", "{", "// no match would be possible", "return", ...
Tests if the buffer starts with the byte array prefix. The byte array prefix must have a size >= this buffer's size. @return True if the buffer starts with the bytes array, otherwise false.
[ "Tests", "if", "the", "buffer", "starts", "with", "the", "byte", "array", "prefix", ".", "The", "byte", "array", "prefix", "must", "have", "a", "size", ">", "=", "this", "buffer", "s", "size", "." ]
b5bc397dbec4537e8149e7ec0733c1d7ed477499
https://github.com/twitter/cloudhopper-commons/blob/b5bc397dbec4537e8149e7ec0733c1d7ed477499/ch-commons-util/src/main/java/com/cloudhopper/commons/util/ByteBuffer.java#L855-L871
3,610
twitter/cloudhopper-commons
ch-commons-util/src/main/java/com/cloudhopper/commons/util/ByteBuffer.java
ByteBuffer.endsWith
public boolean endsWith(byte[] prefix) { //logger.debug("Inside endsWith()"); if ((prefix.length == 0) || (prefix.length > size())) { //It could not match : return false; } boolean match = true; int i = prefix.length - 1; int j = (this.currentWrite...
java
public boolean endsWith(byte[] prefix) { //logger.debug("Inside endsWith()"); if ((prefix.length == 0) || (prefix.length > size())) { //It could not match : return false; } boolean match = true; int i = prefix.length - 1; int j = (this.currentWrite...
[ "public", "boolean", "endsWith", "(", "byte", "[", "]", "prefix", ")", "{", "//logger.debug(\"Inside endsWith()\");", "if", "(", "(", "prefix", ".", "length", "==", "0", ")", "||", "(", "prefix", ".", "length", ">", "size", "(", ")", ")", ")", "{", "//...
Tests if the buffer ends with the bytes array prefix. The byte array prefix must have a size >= this buffer's size. @return True if the buffer ends with the bytes array, otherwise false.
[ "Tests", "if", "the", "buffer", "ends", "with", "the", "bytes", "array", "prefix", ".", "The", "byte", "array", "prefix", "must", "have", "a", "size", ">", "=", "this", "buffer", "s", "size", "." ]
b5bc397dbec4537e8149e7ec0733c1d7ed477499
https://github.com/twitter/cloudhopper-commons/blob/b5bc397dbec4537e8149e7ec0733c1d7ed477499/ch-commons-util/src/main/java/com/cloudhopper/commons/util/ByteBuffer.java#L879-L897
3,611
twitter/cloudhopper-commons
ch-commons-util/src/main/java/com/cloudhopper/commons/util/ByteBuffer.java
ByteBuffer.indexOf
public int indexOf(byte[] bytes, int offset) { // make sure we're not checking against any byte arrays of length 0 if (bytes.length == 0 || size() == 0) { // a match is not possible return -1; } // make sure the offset won't cause us to read past the end ...
java
public int indexOf(byte[] bytes, int offset) { // make sure we're not checking against any byte arrays of length 0 if (bytes.length == 0 || size() == 0) { // a match is not possible return -1; } // make sure the offset won't cause us to read past the end ...
[ "public", "int", "indexOf", "(", "byte", "[", "]", "bytes", ",", "int", "offset", ")", "{", "// make sure we're not checking against any byte arrays of length 0", "if", "(", "bytes", ".", "length", "==", "0", "||", "size", "(", ")", "==", "0", ")", "{", "// ...
Returns the index within this buffer of the first occurrence of the specified bytes after the offset. The bytes to search for must have a size lower than or equal to the current buffer size. This method will return -1 if the bytes are not contained within this byte buffer. @param bytes The byte array to search for @par...
[ "Returns", "the", "index", "within", "this", "buffer", "of", "the", "first", "occurrence", "of", "the", "specified", "bytes", "after", "the", "offset", ".", "The", "bytes", "to", "search", "for", "must", "have", "a", "size", "lower", "than", "or", "equal",...
b5bc397dbec4537e8149e7ec0733c1d7ed477499
https://github.com/twitter/cloudhopper-commons/blob/b5bc397dbec4537e8149e7ec0733c1d7ed477499/ch-commons-util/src/main/java/com/cloudhopper/commons/util/ByteBuffer.java#L921-L948
3,612
twitter/cloudhopper-commons
ch-commons-util/src/main/java/com/cloudhopper/commons/util/ByteBuffer.java
ByteBuffer.toHexString
public String toHexString(int offset, int length) { // is offset, length valid for the current size() of our internal byte[] checkOffsetLength(size(), offset, length); // if length is 0, return an empty string if (length == 0 || size() == 0) { return ""; } S...
java
public String toHexString(int offset, int length) { // is offset, length valid for the current size() of our internal byte[] checkOffsetLength(size(), offset, length); // if length is 0, return an empty string if (length == 0 || size() == 0) { return ""; } S...
[ "public", "String", "toHexString", "(", "int", "offset", ",", "int", "length", ")", "{", "// is offset, length valid for the current size() of our internal byte[]", "checkOffsetLength", "(", "size", "(", ")", ",", "offset", ",", "length", ")", ";", "// if length is 0, r...
Return a hexidecimal String representation of the current buffer with each byte displayed in a 2 character hexidecimal format. Useful for debugging. Convert a ByteBuffer to a String with a hexidecimal format. @param offset @param length @return The string in hex representation
[ "Return", "a", "hexidecimal", "String", "representation", "of", "the", "current", "buffer", "with", "each", "byte", "displayed", "in", "a", "2", "character", "hexidecimal", "format", ".", "Useful", "for", "debugging", ".", "Convert", "a", "ByteBuffer", "to", "...
b5bc397dbec4537e8149e7ec0733c1d7ed477499
https://github.com/twitter/cloudhopper-commons/blob/b5bc397dbec4537e8149e7ec0733c1d7ed477499/ch-commons-util/src/main/java/com/cloudhopper/commons/util/ByteBuffer.java#L1092-L1108
3,613
twitter/cloudhopper-commons
ch-sxmp/src/main/java/com/cloudhopper/sxmp/SxmpSession.java
SxmpSession.process
public Response process(InputStream is) throws IOException, SAXException, ParserConfigurationException { // create a new XML parser SxmpParser parser = new SxmpParser(version); // an instance of an operation we'll be processing as a request Operation operation = null; try { ...
java
public Response process(InputStream is) throws IOException, SAXException, ParserConfigurationException { // create a new XML parser SxmpParser parser = new SxmpParser(version); // an instance of an operation we'll be processing as a request Operation operation = null; try { ...
[ "public", "Response", "process", "(", "InputStream", "is", ")", "throws", "IOException", ",", "SAXException", ",", "ParserConfigurationException", "{", "// create a new XML parser", "SxmpParser", "parser", "=", "new", "SxmpParser", "(", "version", ")", ";", "// an ins...
Processes an InputStream that contains a request. Does its best to only produce a Response that can be written to an OutputStream. Any exception this method throws should be treated as fatal and no attempt should be made to print out valid XML as a response. @param is The InputStream to read the Request from @return A...
[ "Processes", "an", "InputStream", "that", "contains", "a", "request", ".", "Does", "its", "best", "to", "only", "produce", "a", "Response", "that", "can", "be", "written", "to", "an", "OutputStream", ".", "Any", "exception", "this", "method", "throws", "shou...
b5bc397dbec4537e8149e7ec0733c1d7ed477499
https://github.com/twitter/cloudhopper-commons/blob/b5bc397dbec4537e8149e7ec0733c1d7ed477499/ch-sxmp/src/main/java/com/cloudhopper/sxmp/SxmpSession.java#L64-L134
3,614
twitter/cloudhopper-commons
ch-commons-xbean/src/main/java/com/cloudhopper/commons/xbean/util/PropertiesReplacementUtil.java
PropertiesReplacementUtil.loadProperties
static public Properties loadProperties(Properties base, File file) throws IOException { FileReader reader = new FileReader(file); Properties props = new Properties(); props.load(reader); if (base != null) props.putAll(base); reader.close(); return props; }
java
static public Properties loadProperties(Properties base, File file) throws IOException { FileReader reader = new FileReader(file); Properties props = new Properties(); props.load(reader); if (base != null) props.putAll(base); reader.close(); return props; }
[ "static", "public", "Properties", "loadProperties", "(", "Properties", "base", ",", "File", "file", ")", "throws", "IOException", "{", "FileReader", "reader", "=", "new", "FileReader", "(", "file", ")", ";", "Properties", "props", "=", "new", "Properties", "("...
Loads the given file into a Properties object. @param base Properties that should override those loaded from the file @param file The file to load @return Properties loaded from the file
[ "Loads", "the", "given", "file", "into", "a", "Properties", "object", "." ]
b5bc397dbec4537e8149e7ec0733c1d7ed477499
https://github.com/twitter/cloudhopper-commons/blob/b5bc397dbec4537e8149e7ec0733c1d7ed477499/ch-commons-xbean/src/main/java/com/cloudhopper/commons/xbean/util/PropertiesReplacementUtil.java#L170-L177
3,615
twitter/cloudhopper-commons
ch-httpclient-util/src/main/java/com/cloudhopper/httpclient/util/HttpClientUtil.java
HttpClientUtil.shutdownQuietly
static public void shutdownQuietly(HttpClient http) { if (http != null) { try { http.getConnectionManager().shutdown(); } catch (Exception ignore) { // do nothing } } }
java
static public void shutdownQuietly(HttpClient http) { if (http != null) { try { http.getConnectionManager().shutdown(); } catch (Exception ignore) { // do nothing } } }
[ "static", "public", "void", "shutdownQuietly", "(", "HttpClient", "http", ")", "{", "if", "(", "http", "!=", "null", ")", "{", "try", "{", "http", ".", "getConnectionManager", "(", ")", ".", "shutdown", "(", ")", ";", "}", "catch", "(", "Exception", "i...
Quitely shuts down an HttpClient instance by shutting down its connection manager and ignoring any errors that occur. @param http The HttpClient to shutdown
[ "Quitely", "shuts", "down", "an", "HttpClient", "instance", "by", "shutting", "down", "its", "connection", "manager", "and", "ignoring", "any", "errors", "that", "occur", "." ]
b5bc397dbec4537e8149e7ec0733c1d7ed477499
https://github.com/twitter/cloudhopper-commons/blob/b5bc397dbec4537e8149e7ec0733c1d7ed477499/ch-httpclient-util/src/main/java/com/cloudhopper/httpclient/util/HttpClientUtil.java#L43-L51
3,616
twitter/cloudhopper-commons
ch-commons-charset/src/main/java/com/cloudhopper/commons/charset/MobileTextUtil.java
MobileTextUtil.replaceSafeUnicodeChars
static public int replaceSafeUnicodeChars(StringBuilder buffer) { int replaced = 0; for (int i = 0; i < buffer.length(); i++) { char c = buffer.charAt(i); for (int j = 0; j < CHAR_TABLE.length; j++) { if (c == CHAR_TABLE[j][0]) { replaced++; ...
java
static public int replaceSafeUnicodeChars(StringBuilder buffer) { int replaced = 0; for (int i = 0; i < buffer.length(); i++) { char c = buffer.charAt(i); for (int j = 0; j < CHAR_TABLE.length; j++) { if (c == CHAR_TABLE[j][0]) { replaced++; ...
[ "static", "public", "int", "replaceSafeUnicodeChars", "(", "StringBuilder", "buffer", ")", "{", "int", "replaced", "=", "0", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "buffer", ".", "length", "(", ")", ";", "i", "++", ")", "{", "char", ...
Replace unicode characters with their ascii equivalents, limiting replacement to "safe" characters such as smart quotes to dumb quotes. "Safe" is subjective, but generally the agreement is that these character replacements should not change the meaning of the string in any meaninful way. @param buffer The buffer conta...
[ "Replace", "unicode", "characters", "with", "their", "ascii", "equivalents", "limiting", "replacement", "to", "safe", "characters", "such", "as", "smart", "quotes", "to", "dumb", "quotes", ".", "Safe", "is", "subjective", "but", "generally", "the", "agreement", ...
b5bc397dbec4537e8149e7ec0733c1d7ed477499
https://github.com/twitter/cloudhopper-commons/blob/b5bc397dbec4537e8149e7ec0733c1d7ed477499/ch-commons-charset/src/main/java/com/cloudhopper/commons/charset/MobileTextUtil.java#L69-L81
3,617
twitter/cloudhopper-commons
ch-commons-util/src/main/java/com/cloudhopper/commons/util/codec/Base64Codec.java
Base64Codec.encode
public static String encode(byte[] rawData) { StringBuilder buffer = new StringBuilder(4 * rawData.length / 3); int pos = 0; int iterations = rawData.length / 3; for (int i = 0; i < iterations; i++) { int value = ((rawData[pos++] & 0xFF) << 16) | ((rawDat...
java
public static String encode(byte[] rawData) { StringBuilder buffer = new StringBuilder(4 * rawData.length / 3); int pos = 0; int iterations = rawData.length / 3; for (int i = 0; i < iterations; i++) { int value = ((rawData[pos++] & 0xFF) << 16) | ((rawDat...
[ "public", "static", "String", "encode", "(", "byte", "[", "]", "rawData", ")", "{", "StringBuilder", "buffer", "=", "new", "StringBuilder", "(", "4", "*", "rawData", ".", "length", "/", "3", ")", ";", "int", "pos", "=", "0", ";", "int", "iterations", ...
Encodes the provided raw data using base64. @param rawData The raw data to encode. It must not be <CODE>null</CODE>. @return The base64-encoded representation of the provided raw data.
[ "Encodes", "the", "provided", "raw", "data", "using", "base64", "." ]
b5bc397dbec4537e8149e7ec0733c1d7ed477499
https://github.com/twitter/cloudhopper-commons/blob/b5bc397dbec4537e8149e7ec0733c1d7ed477499/ch-commons-util/src/main/java/com/cloudhopper/commons/util/codec/Base64Codec.java#L64-L95
3,618
twitter/cloudhopper-commons
ch-commons-util/src/main/java/com/cloudhopper/commons/util/filefilter/FileNameStartsWithFilter.java
FileNameStartsWithFilter.accept
public boolean accept(File file) { if (caseSensitive) { return file.getName().startsWith(string0); } else { return file.getName().toLowerCase().startsWith(string0.toLowerCase()); } }
java
public boolean accept(File file) { if (caseSensitive) { return file.getName().startsWith(string0); } else { return file.getName().toLowerCase().startsWith(string0.toLowerCase()); } }
[ "public", "boolean", "accept", "(", "File", "file", ")", "{", "if", "(", "caseSensitive", ")", "{", "return", "file", ".", "getName", "(", ")", ".", "startsWith", "(", "string0", ")", ";", "}", "else", "{", "return", "file", ".", "getName", "(", ")",...
Accepts a File if its filename startsWith a specific string. @param file The file to match @return True if the File startsWith the specific string, otherwise false
[ "Accepts", "a", "File", "if", "its", "filename", "startsWith", "a", "specific", "string", "." ]
b5bc397dbec4537e8149e7ec0733c1d7ed477499
https://github.com/twitter/cloudhopper-commons/blob/b5bc397dbec4537e8149e7ec0733c1d7ed477499/ch-commons-util/src/main/java/com/cloudhopper/commons/util/filefilter/FileNameStartsWithFilter.java#L53-L59
3,619
twitter/cloudhopper-commons
ch-commons-charset/src/main/java/com/cloudhopper/commons/charset/GSMCharset.java
GSMCharset.decode
@Override public void decode(byte[] bytes, StringBuilder buffer) { if (bytes == null) { // append nothing return; } char[] table = CHAR_TABLE; for (int i = 0; i < bytes.length; i++) { int code = (int)bytes[i] & 0x000000ff; if (code == ...
java
@Override public void decode(byte[] bytes, StringBuilder buffer) { if (bytes == null) { // append nothing return; } char[] table = CHAR_TABLE; for (int i = 0; i < bytes.length; i++) { int code = (int)bytes[i] & 0x000000ff; if (code == ...
[ "@", "Override", "public", "void", "decode", "(", "byte", "[", "]", "bytes", ",", "StringBuilder", "buffer", ")", "{", "if", "(", "bytes", "==", "null", ")", "{", "// append nothing", "return", ";", "}", "char", "[", "]", "table", "=", "CHAR_TABLE", ";...
Decode an SMS default alphabet-encoded octet string into a Java String.
[ "Decode", "an", "SMS", "default", "alphabet", "-", "encoded", "octet", "string", "into", "a", "Java", "String", "." ]
b5bc397dbec4537e8149e7ec0733c1d7ed477499
https://github.com/twitter/cloudhopper-commons/blob/b5bc397dbec4537e8149e7ec0733c1d7ed477499/ch-commons-charset/src/main/java/com/cloudhopper/commons/charset/GSMCharset.java#L229-L248
3,620
twitter/cloudhopper-commons
ch-commons-util/src/main/java/com/cloudhopper/commons/util/windowing/Window.java
Window.get
public WindowFuture<K,R,P> get(K key) { return this.futures.get(key); }
java
public WindowFuture<K,R,P> get(K key) { return this.futures.get(key); }
[ "public", "WindowFuture", "<", "K", ",", "R", ",", "P", ">", "get", "(", "K", "key", ")", "{", "return", "this", ".", "futures", ".", "get", "(", "key", ")", ";", "}" ]
Gets the a future by its key. @param key The key for the request @return The future or null if it doesn't exist.
[ "Gets", "the", "a", "future", "by", "its", "key", "." ]
b5bc397dbec4537e8149e7ec0733c1d7ed477499
https://github.com/twitter/cloudhopper-commons/blob/b5bc397dbec4537e8149e7ec0733c1d7ed477499/ch-commons-util/src/main/java/com/cloudhopper/commons/util/windowing/Window.java#L198-L200
3,621
twitter/cloudhopper-commons
ch-commons-util/src/main/java/com/cloudhopper/commons/util/windowing/Window.java
Window.addListener
public void addListener(WindowListener<K,R,P> listener) { this.listeners.addIfAbsent(new UnwrappedWeakReference<WindowListener<K,R,P>>(listener)); }
java
public void addListener(WindowListener<K,R,P> listener) { this.listeners.addIfAbsent(new UnwrappedWeakReference<WindowListener<K,R,P>>(listener)); }
[ "public", "void", "addListener", "(", "WindowListener", "<", "K", ",", "R", ",", "P", ">", "listener", ")", "{", "this", ".", "listeners", ".", "addIfAbsent", "(", "new", "UnwrappedWeakReference", "<", "WindowListener", "<", "K", ",", "R", ",", "P", ">",...
Adds a new WindowListener if and only if it isn't already present. @param listener The listener to add
[ "Adds", "a", "new", "WindowListener", "if", "and", "only", "if", "it", "isn", "t", "already", "present", "." ]
b5bc397dbec4537e8149e7ec0733c1d7ed477499
https://github.com/twitter/cloudhopper-commons/blob/b5bc397dbec4537e8149e7ec0733c1d7ed477499/ch-commons-util/src/main/java/com/cloudhopper/commons/util/windowing/Window.java#L206-L208
3,622
twitter/cloudhopper-commons
ch-commons-util/src/main/java/com/cloudhopper/commons/util/windowing/Window.java
Window.removeListener
public void removeListener(WindowListener<K,R,P> listener) { this.listeners.remove(new UnwrappedWeakReference<WindowListener<K,R,P>>(listener)); }
java
public void removeListener(WindowListener<K,R,P> listener) { this.listeners.remove(new UnwrappedWeakReference<WindowListener<K,R,P>>(listener)); }
[ "public", "void", "removeListener", "(", "WindowListener", "<", "K", ",", "R", ",", "P", ">", "listener", ")", "{", "this", ".", "listeners", ".", "remove", "(", "new", "UnwrappedWeakReference", "<", "WindowListener", "<", "K", ",", "R", ",", "P", ">", ...
Removes a WindowListener if it is present. @param listener The listener to remove
[ "Removes", "a", "WindowListener", "if", "it", "is", "present", "." ]
b5bc397dbec4537e8149e7ec0733c1d7ed477499
https://github.com/twitter/cloudhopper-commons/blob/b5bc397dbec4537e8149e7ec0733c1d7ed477499/ch-commons-util/src/main/java/com/cloudhopper/commons/util/windowing/Window.java#L214-L216
3,623
twitter/cloudhopper-commons
ch-commons-util/src/main/java/com/cloudhopper/commons/util/windowing/Window.java
Window.startMonitor
public synchronized boolean startMonitor() { if (this.executor != null) { if (this.monitorHandle == null) { this.monitorHandle = this.executor.scheduleWithFixedDelay(this.monitor, this.monitorInterval, this.monitorInterval, TimeUnit.MILLISECONDS); } return tru...
java
public synchronized boolean startMonitor() { if (this.executor != null) { if (this.monitorHandle == null) { this.monitorHandle = this.executor.scheduleWithFixedDelay(this.monitor, this.monitorInterval, this.monitorInterval, TimeUnit.MILLISECONDS); } return tru...
[ "public", "synchronized", "boolean", "startMonitor", "(", ")", "{", "if", "(", "this", ".", "executor", "!=", "null", ")", "{", "if", "(", "this", ".", "monitorHandle", "==", "null", ")", "{", "this", ".", "monitorHandle", "=", "this", ".", "executor", ...
Starts the monitor if this Window has an executor. Safe to call multiple times. @return True if the monitor was started (true will be returned if it was already previously started).
[ "Starts", "the", "monitor", "if", "this", "Window", "has", "an", "executor", ".", "Safe", "to", "call", "multiple", "times", "." ]
b5bc397dbec4537e8149e7ec0733c1d7ed477499
https://github.com/twitter/cloudhopper-commons/blob/b5bc397dbec4537e8149e7ec0733c1d7ed477499/ch-commons-util/src/main/java/com/cloudhopper/commons/util/windowing/Window.java#L246-L254
3,624
twitter/cloudhopper-commons
ch-commons-util/src/main/java/com/cloudhopper/commons/util/windowing/Window.java
Window.createSortedSnapshot
public Map<K,WindowFuture<K,R,P>> createSortedSnapshot() { Map<K,WindowFuture<K,R,P>> sortedRequests = new TreeMap<K,WindowFuture<K,R,P>>(); sortedRequests.putAll(this.futures); return sortedRequests; }
java
public Map<K,WindowFuture<K,R,P>> createSortedSnapshot() { Map<K,WindowFuture<K,R,P>> sortedRequests = new TreeMap<K,WindowFuture<K,R,P>>(); sortedRequests.putAll(this.futures); return sortedRequests; }
[ "public", "Map", "<", "K", ",", "WindowFuture", "<", "K", ",", "R", ",", "P", ">", ">", "createSortedSnapshot", "(", ")", "{", "Map", "<", "K", ",", "WindowFuture", "<", "K", ",", "R", ",", "P", ">", ">", "sortedRequests", "=", "new", "TreeMap", ...
Creates an ordered snapshot of the requests in this window. The entries will be sorted by the natural ascending order of the key. A new map is allocated when calling this method, so be careful about calling it once. @return A new map instance representing all requests sorted by the natural ascending order of its key.
[ "Creates", "an", "ordered", "snapshot", "of", "the", "requests", "in", "this", "window", ".", "The", "entries", "will", "be", "sorted", "by", "the", "natural", "ascending", "order", "of", "the", "key", ".", "A", "new", "map", "is", "allocated", "when", "...
b5bc397dbec4537e8149e7ec0733c1d7ed477499
https://github.com/twitter/cloudhopper-commons/blob/b5bc397dbec4537e8149e7ec0733c1d7ed477499/ch-commons-util/src/main/java/com/cloudhopper/commons/util/windowing/Window.java#L274-L278
3,625
twitter/cloudhopper-commons
ch-commons-util/src/main/java/com/cloudhopper/commons/util/windowing/Window.java
Window.offer
public WindowFuture offer(K key, R request, long offerTimeoutMillis, long expireTimeoutMillis, boolean callerWaitingHint) throws DuplicateKeyException, OfferTimeoutException, PendingOfferAbortedException, InterruptedException { if (offerTimeoutMillis < 0) { throw new IllegalArgumentException("offerT...
java
public WindowFuture offer(K key, R request, long offerTimeoutMillis, long expireTimeoutMillis, boolean callerWaitingHint) throws DuplicateKeyException, OfferTimeoutException, PendingOfferAbortedException, InterruptedException { if (offerTimeoutMillis < 0) { throw new IllegalArgumentException("offerT...
[ "public", "WindowFuture", "offer", "(", "K", "key", ",", "R", "request", ",", "long", "offerTimeoutMillis", ",", "long", "expireTimeoutMillis", ",", "boolean", "callerWaitingHint", ")", "throws", "DuplicateKeyException", ",", "OfferTimeoutException", ",", "PendingOffe...
Offers a request for acceptance, waiting for the specified amount of time in case it could not immediately accepted. @param key The key for the request. A protocol's sequence number is a good choice. @param request The request to offer @param offerTimeoutMillis The amount of time (in milliseconds) to wait for the offer...
[ "Offers", "a", "request", "for", "acceptance", "waiting", "for", "the", "specified", "amount", "of", "time", "in", "case", "it", "could", "not", "immediately", "accepted", "." ]
b5bc397dbec4537e8149e7ec0733c1d7ed477499
https://github.com/twitter/cloudhopper-commons/blob/b5bc397dbec4537e8149e7ec0733c1d7ed477499/ch-commons-util/src/main/java/com/cloudhopper/commons/util/windowing/Window.java#L359-L411
3,626
twitter/cloudhopper-commons
ch-commons-util/src/main/java/com/cloudhopper/commons/util/windowing/Window.java
Window.endPendingOffer
private boolean endPendingOffer() { int newValue = this.pendingOffers.decrementAndGet(); // if newValue reaches zero, make sure to always reset "offeringAborted" if (newValue == 0) { // if slotWaitingCanceled was true, then reset it back to false, and // return true to ma...
java
private boolean endPendingOffer() { int newValue = this.pendingOffers.decrementAndGet(); // if newValue reaches zero, make sure to always reset "offeringAborted" if (newValue == 0) { // if slotWaitingCanceled was true, then reset it back to false, and // return true to ma...
[ "private", "boolean", "endPendingOffer", "(", ")", "{", "int", "newValue", "=", "this", ".", "pendingOffers", ".", "decrementAndGet", "(", ")", ";", "// if newValue reaches zero, make sure to always reset \"offeringAborted\"", "if", "(", "newValue", "==", "0", ")", "{...
End waiting for a pending offer to be accepted. Decrements pendingOffers by 1. If "pendingOffersAborted" is true and pendingOffers reaches 0 then pendingOffersAborted will be reset to false. @return True if a pending offer should be aborted. False if a pending offer can continue waiting if needed.
[ "End", "waiting", "for", "a", "pending", "offer", "to", "be", "accepted", ".", "Decrements", "pendingOffers", "by", "1", ".", "If", "pendingOffersAborted", "is", "true", "and", "pendingOffers", "reaches", "0", "then", "pendingOffersAborted", "will", "be", "reset...
b5bc397dbec4537e8149e7ec0733c1d7ed477499
https://github.com/twitter/cloudhopper-commons/blob/b5bc397dbec4537e8149e7ec0733c1d7ed477499/ch-commons-util/src/main/java/com/cloudhopper/commons/util/windowing/Window.java#L435-L446
3,627
twitter/cloudhopper-commons
ch-commons-util/src/main/java/com/cloudhopper/commons/util/filefilter/FileNameEndsWithFilter.java
FileNameEndsWithFilter.accept
public boolean accept(File file) { if (caseSensitive) { return file.getName().endsWith(string0); } else { return file.getName().toLowerCase().endsWith(string0.toLowerCase()); } }
java
public boolean accept(File file) { if (caseSensitive) { return file.getName().endsWith(string0); } else { return file.getName().toLowerCase().endsWith(string0.toLowerCase()); } }
[ "public", "boolean", "accept", "(", "File", "file", ")", "{", "if", "(", "caseSensitive", ")", "{", "return", "file", ".", "getName", "(", ")", ".", "endsWith", "(", "string0", ")", ";", "}", "else", "{", "return", "file", ".", "getName", "(", ")", ...
Accepts a File if its filename endsWith a specific string. @param file The file to match @return True if the File endsWith the specific string, otherwise false
[ "Accepts", "a", "File", "if", "its", "filename", "endsWith", "a", "specific", "string", "." ]
b5bc397dbec4537e8149e7ec0733c1d7ed477499
https://github.com/twitter/cloudhopper-commons/blob/b5bc397dbec4537e8149e7ec0733c1d7ed477499/ch-commons-util/src/main/java/com/cloudhopper/commons/util/filefilter/FileNameEndsWithFilter.java#L53-L59
3,628
twitter/cloudhopper-commons
ch-sxmp/src/main/java/com/cloudhopper/sxmp/util/MobileAddressUtil.java
MobileAddressUtil.parseType
static public MobileAddress.Type parseType(String type) { if (type.equalsIgnoreCase("network")) { return MobileAddress.Type.NETWORK; } else if (type.equalsIgnoreCase("national")) { return MobileAddress.Type.NATIONAL; } else if (type.equalsIgnoreCase("alphanumeric")) { ...
java
static public MobileAddress.Type parseType(String type) { if (type.equalsIgnoreCase("network")) { return MobileAddress.Type.NETWORK; } else if (type.equalsIgnoreCase("national")) { return MobileAddress.Type.NATIONAL; } else if (type.equalsIgnoreCase("alphanumeric")) { ...
[ "static", "public", "MobileAddress", ".", "Type", "parseType", "(", "String", "type", ")", "{", "if", "(", "type", ".", "equalsIgnoreCase", "(", "\"network\"", ")", ")", "{", "return", "MobileAddress", ".", "Type", ".", "NETWORK", ";", "}", "else", "if", ...
Parses string into a MobileAddress type. Case insensitive. Returns null if no match was found.
[ "Parses", "string", "into", "a", "MobileAddress", "type", ".", "Case", "insensitive", ".", "Returns", "null", "if", "no", "match", "was", "found", "." ]
b5bc397dbec4537e8149e7ec0733c1d7ed477499
https://github.com/twitter/cloudhopper-commons/blob/b5bc397dbec4537e8149e7ec0733c1d7ed477499/ch-sxmp/src/main/java/com/cloudhopper/sxmp/util/MobileAddressUtil.java#L37-L51
3,629
twitter/cloudhopper-commons
ch-commons-util/src/main/java/com/cloudhopper/commons/util/ClassUtil.java
ClassUtil.getClassHierarchy
public static Class<?>[] getClassHierarchy(Class<?> type) { ArrayDeque<Class<?>> classes = new ArrayDeque<Class<?>>(); // class to start our search from, we'll loop thru the entire class hierarchy Class<?> classType = type; // keep searching up until we reach an Object class type ...
java
public static Class<?>[] getClassHierarchy(Class<?> type) { ArrayDeque<Class<?>> classes = new ArrayDeque<Class<?>>(); // class to start our search from, we'll loop thru the entire class hierarchy Class<?> classType = type; // keep searching up until we reach an Object class type ...
[ "public", "static", "Class", "<", "?", ">", "[", "]", "getClassHierarchy", "(", "Class", "<", "?", ">", "type", ")", "{", "ArrayDeque", "<", "Class", "<", "?", ">", ">", "classes", "=", "new", "ArrayDeque", "<", "Class", "<", "?", ">", ">", "(", ...
Returns an array of class objects representing the entire class hierarchy with the most-super class as the first element followed by all subclasses in the order they are declared. This method does not include the generic Object type in its list. If this class represents the Object type, this method will return a zero-s...
[ "Returns", "an", "array", "of", "class", "objects", "representing", "the", "entire", "class", "hierarchy", "with", "the", "most", "-", "super", "class", "as", "the", "first", "element", "followed", "by", "all", "subclasses", "in", "the", "order", "they", "ar...
b5bc397dbec4537e8149e7ec0733c1d7ed477499
https://github.com/twitter/cloudhopper-commons/blob/b5bc397dbec4537e8149e7ec0733c1d7ed477499/ch-commons-util/src/main/java/com/cloudhopper/commons/util/ClassUtil.java#L74-L85
3,630
twitter/cloudhopper-commons
ch-commons-util/src/main/java/com/cloudhopper/commons/util/ClassUtil.java
ClassUtil.getMethod
public static Method getMethod(Class<?> type, String name, Class<?> returnType, Class<?> paramType, boolean caseSensitive) throws IllegalAccessException, NoSuchMethodException { // flag to help modify the exception to make it a little easier for debugging boolean methodNameFound = false...
java
public static Method getMethod(Class<?> type, String name, Class<?> returnType, Class<?> paramType, boolean caseSensitive) throws IllegalAccessException, NoSuchMethodException { // flag to help modify the exception to make it a little easier for debugging boolean methodNameFound = false...
[ "public", "static", "Method", "getMethod", "(", "Class", "<", "?", ">", "type", ",", "String", "name", ",", "Class", "<", "?", ">", "returnType", ",", "Class", "<", "?", ">", "paramType", ",", "boolean", "caseSensitive", ")", "throws", "IllegalAccessExcept...
Gets the public method within the type that matches the method name, return type, and single parameter type. Optionally is a case sensitive search. Useful for searching for "bean" methods on classes. @param type The class to search for the method @param name The name of the method to search for @param returnType The ex...
[ "Gets", "the", "public", "method", "within", "the", "type", "that", "matches", "the", "method", "name", "return", "type", "and", "single", "parameter", "type", ".", "Optionally", "is", "a", "case", "sensitive", "search", ".", "Useful", "for", "searching", "f...
b5bc397dbec4537e8149e7ec0733c1d7ed477499
https://github.com/twitter/cloudhopper-commons/blob/b5bc397dbec4537e8149e7ec0733c1d7ed477499/ch-commons-util/src/main/java/com/cloudhopper/commons/util/ClassUtil.java#L157-L238
3,631
twitter/cloudhopper-commons
ch-commons-util/src/main/java/com/cloudhopper/commons/util/LoadBalancedLists.java
LoadBalancedLists.synchronizedList
static public <E> LoadBalancedList<E> synchronizedList(LoadBalancedList<E> list) { return new ConcurrentLoadBalancedList<E>(list); }
java
static public <E> LoadBalancedList<E> synchronizedList(LoadBalancedList<E> list) { return new ConcurrentLoadBalancedList<E>(list); }
[ "static", "public", "<", "E", ">", "LoadBalancedList", "<", "E", ">", "synchronizedList", "(", "LoadBalancedList", "<", "E", ">", "list", ")", "{", "return", "new", "ConcurrentLoadBalancedList", "<", "E", ">", "(", "list", ")", ";", "}" ]
Creates a synchronized version of a LoadBalancedList by putting a lock around any method that reads or writes to the internal data structure. @param list The list to synchronize @return A wrapper around the original list that provides synchronized access.
[ "Creates", "a", "synchronized", "version", "of", "a", "LoadBalancedList", "by", "putting", "a", "lock", "around", "any", "method", "that", "reads", "or", "writes", "to", "the", "internal", "data", "structure", "." ]
b5bc397dbec4537e8149e7ec0733c1d7ed477499
https://github.com/twitter/cloudhopper-commons/blob/b5bc397dbec4537e8149e7ec0733c1d7ed477499/ch-commons-util/src/main/java/com/cloudhopper/commons/util/LoadBalancedLists.java#L40-L42
3,632
twitter/cloudhopper-commons
ch-commons-util/src/main/java/com/cloudhopper/commons/util/HexUtil.java
HexUtil.toHexString
static public String toHexString(byte value) { StringBuilder buffer = new StringBuilder(2); appendHexString(buffer, value); return buffer.toString(); }
java
static public String toHexString(byte value) { StringBuilder buffer = new StringBuilder(2); appendHexString(buffer, value); return buffer.toString(); }
[ "static", "public", "String", "toHexString", "(", "byte", "value", ")", "{", "StringBuilder", "buffer", "=", "new", "StringBuilder", "(", "2", ")", ";", "appendHexString", "(", "buffer", ",", "value", ")", ";", "return", "buffer", ".", "toString", "(", ")"...
Creates a 2 character hex String from a byte with the byte in a "Big Endian" hexidecimal format. For example, a byte 0x34 will be returned as a String in format "34". A byte of value 0 will be returned as "00". @param value The byte value that will be converted to a hexidecimal String.
[ "Creates", "a", "2", "character", "hex", "String", "from", "a", "byte", "with", "the", "byte", "in", "a", "Big", "Endian", "hexidecimal", "format", ".", "For", "example", "a", "byte", "0x34", "will", "be", "returned", "as", "a", "String", "in", "format",...
b5bc397dbec4537e8149e7ec0733c1d7ed477499
https://github.com/twitter/cloudhopper-commons/blob/b5bc397dbec4537e8149e7ec0733c1d7ed477499/ch-commons-util/src/main/java/com/cloudhopper/commons/util/HexUtil.java#L129-L133
3,633
twitter/cloudhopper-commons
ch-commons-util/src/main/java/com/cloudhopper/commons/util/HexUtil.java
HexUtil.appendHexString
static public void appendHexString(StringBuilder buffer, byte value) { assertNotNull(buffer); int nibble = (value & 0xF0) >>> 4; buffer.append(HEX_TABLE[nibble]); nibble = (value & 0x0F); buffer.append(HEX_TABLE[nibble]); }
java
static public void appendHexString(StringBuilder buffer, byte value) { assertNotNull(buffer); int nibble = (value & 0xF0) >>> 4; buffer.append(HEX_TABLE[nibble]); nibble = (value & 0x0F); buffer.append(HEX_TABLE[nibble]); }
[ "static", "public", "void", "appendHexString", "(", "StringBuilder", "buffer", ",", "byte", "value", ")", "{", "assertNotNull", "(", "buffer", ")", ";", "int", "nibble", "=", "(", "value", "&", "0xF0", ")", ">>>", "4", ";", "buffer", ".", "append", "(", ...
Appends 2 characters to a StringBuilder with the byte in a "Big Endian" hexidecimal format. For example, a byte 0x34 will be appended as a String in format "34". A byte of value 0 will be appended as "00". @param buffer The StringBuilder the byte value in hexidecimal format will be appended to. If the buffer is null,...
[ "Appends", "2", "characters", "to", "a", "StringBuilder", "with", "the", "byte", "in", "a", "Big", "Endian", "hexidecimal", "format", ".", "For", "example", "a", "byte", "0x34", "will", "be", "appended", "as", "a", "String", "in", "format", "34", ".", "A...
b5bc397dbec4537e8149e7ec0733c1d7ed477499
https://github.com/twitter/cloudhopper-commons/blob/b5bc397dbec4537e8149e7ec0733c1d7ed477499/ch-commons-util/src/main/java/com/cloudhopper/commons/util/HexUtil.java#L144-L150
3,634
twitter/cloudhopper-commons
ch-commons-util/src/main/java/com/cloudhopper/commons/util/HexUtil.java
HexUtil.appendHexString
static public void appendHexString(StringBuilder buffer, short value) { assertNotNull(buffer); int nibble = (value & 0xF000) >>> 12; buffer.append(HEX_TABLE[nibble]); nibble = (value & 0x0F00) >>> 8; buffer.append(HEX_TABLE[nibble]); nibble = (value & 0x00F0) >>> 4; ...
java
static public void appendHexString(StringBuilder buffer, short value) { assertNotNull(buffer); int nibble = (value & 0xF000) >>> 12; buffer.append(HEX_TABLE[nibble]); nibble = (value & 0x0F00) >>> 8; buffer.append(HEX_TABLE[nibble]); nibble = (value & 0x00F0) >>> 4; ...
[ "static", "public", "void", "appendHexString", "(", "StringBuilder", "buffer", ",", "short", "value", ")", "{", "assertNotNull", "(", "buffer", ")", ";", "int", "nibble", "=", "(", "value", "&", "0xF000", ")", ">>>", "12", ";", "buffer", ".", "append", "...
Appends 4 characters to a StringBuilder with the short in a "Big Endian" hexidecimal format. For example, a short 0x1234 will be appended as a String in format "1234". A short of value 0 will be appended as "0000". @param buffer The StringBuilder the short value in hexidecimal format will be appended to. If the buffer...
[ "Appends", "4", "characters", "to", "a", "StringBuilder", "with", "the", "short", "in", "a", "Big", "Endian", "hexidecimal", "format", ".", "For", "example", "a", "short", "0x1234", "will", "be", "appended", "as", "a", "String", "in", "format", "1234", "."...
b5bc397dbec4537e8149e7ec0733c1d7ed477499
https://github.com/twitter/cloudhopper-commons/blob/b5bc397dbec4537e8149e7ec0733c1d7ed477499/ch-commons-util/src/main/java/com/cloudhopper/commons/util/HexUtil.java#L173-L183
3,635
twitter/cloudhopper-commons
ch-commons-util/src/main/java/com/cloudhopper/commons/util/HexUtil.java
HexUtil.appendHexString
static public void appendHexString(StringBuilder buffer, int value) { assertNotNull(buffer); int nibble = (value & 0xF0000000) >>> 28; buffer.append(HEX_TABLE[nibble]); nibble = (value & 0x0F000000) >>> 24; buffer.append(HEX_TABLE[nibble]); nibble = (value & 0x00F00000) >...
java
static public void appendHexString(StringBuilder buffer, int value) { assertNotNull(buffer); int nibble = (value & 0xF0000000) >>> 28; buffer.append(HEX_TABLE[nibble]); nibble = (value & 0x0F000000) >>> 24; buffer.append(HEX_TABLE[nibble]); nibble = (value & 0x00F00000) >...
[ "static", "public", "void", "appendHexString", "(", "StringBuilder", "buffer", ",", "int", "value", ")", "{", "assertNotNull", "(", "buffer", ")", ";", "int", "nibble", "=", "(", "value", "&", "0xF0000000", ")", ">>>", "28", ";", "buffer", ".", "append", ...
Appends 8 characters to a StringBuilder with the int in a "Big Endian" hexidecimal format. For example, a int 0xFFAA1234 will be appended as a String in format "FFAA1234". A int of value 0 will be appended as "00000000". @param buffer The StringBuilder the int value in hexidecimal format will be appended to. If the bu...
[ "Appends", "8", "characters", "to", "a", "StringBuilder", "with", "the", "int", "in", "a", "Big", "Endian", "hexidecimal", "format", ".", "For", "example", "a", "int", "0xFFAA1234", "will", "be", "appended", "as", "a", "String", "in", "format", "FFAA1234", ...
b5bc397dbec4537e8149e7ec0733c1d7ed477499
https://github.com/twitter/cloudhopper-commons/blob/b5bc397dbec4537e8149e7ec0733c1d7ed477499/ch-commons-util/src/main/java/com/cloudhopper/commons/util/HexUtil.java#L206-L224
3,636
twitter/cloudhopper-commons
ch-commons-util/src/main/java/com/cloudhopper/commons/util/HexUtil.java
HexUtil.appendHexString
static public void appendHexString(StringBuilder buffer, long value) { appendHexString(buffer, (int)((value & 0xFFFFFFFF00000000L) >>> 32)); appendHexString(buffer, (int)(value & 0x00000000FFFFFFFFL)); }
java
static public void appendHexString(StringBuilder buffer, long value) { appendHexString(buffer, (int)((value & 0xFFFFFFFF00000000L) >>> 32)); appendHexString(buffer, (int)(value & 0x00000000FFFFFFFFL)); }
[ "static", "public", "void", "appendHexString", "(", "StringBuilder", "buffer", ",", "long", "value", ")", "{", "appendHexString", "(", "buffer", ",", "(", "int", ")", "(", "(", "value", "&", "0xFFFFFFFF00000000", "L", ")", ">>>", "32", ")", ")", ";", "ap...
Appends 16 characters to a StringBuilder with the long in a "Big Endian" hexidecimal format. For example, a long 0xAABBCCDDEE123456 will be appended as a String in format "AABBCCDDEE123456". A long of value 0 will be appended as "0000000000000000". @param buffer The StringBuilder the long value in hexidecimal format wi...
[ "Appends", "16", "characters", "to", "a", "StringBuilder", "with", "the", "long", "in", "a", "Big", "Endian", "hexidecimal", "format", ".", "For", "example", "a", "long", "0xAABBCCDDEE123456", "will", "be", "appended", "as", "a", "String", "in", "format", "A...
b5bc397dbec4537e8149e7ec0733c1d7ed477499
https://github.com/twitter/cloudhopper-commons/blob/b5bc397dbec4537e8149e7ec0733c1d7ed477499/ch-commons-util/src/main/java/com/cloudhopper/commons/util/HexUtil.java#L247-L250
3,637
twitter/cloudhopper-commons
ch-commons-util/src/main/java/com/cloudhopper/commons/util/HexUtil.java
HexUtil.hexCharToIntValue
static public int hexCharToIntValue(char c) { if (c == '0') { return 0; } else if (c == '1') { return 1; } else if (c == '2') { return 2; } else if (c == '3') { return 3; } else if (c == '4') { return 4; } else i...
java
static public int hexCharToIntValue(char c) { if (c == '0') { return 0; } else if (c == '1') { return 1; } else if (c == '2') { return 2; } else if (c == '3') { return 3; } else if (c == '4') { return 4; } else i...
[ "static", "public", "int", "hexCharToIntValue", "(", "char", "c", ")", "{", "if", "(", "c", "==", "'", "'", ")", "{", "return", "0", ";", "}", "else", "if", "(", "c", "==", "'", "'", ")", "{", "return", "1", ";", "}", "else", "if", "(", "c", ...
Converts a hexidecimal character such as '0' or 'A' or 'a' to its integer value such as 0 or 10. Used to decode hexidecimal Strings to integer values. @param c The hexidecimal character @return The integer value the character represents @throws IllegalArgumentException Thrown if a character that does not represent a h...
[ "Converts", "a", "hexidecimal", "character", "such", "as", "0", "or", "A", "or", "a", "to", "its", "integer", "value", "such", "as", "0", "or", "10", ".", "Used", "to", "decode", "hexidecimal", "Strings", "to", "integer", "values", "." ]
b5bc397dbec4537e8149e7ec0733c1d7ed477499
https://github.com/twitter/cloudhopper-commons/blob/b5bc397dbec4537e8149e7ec0733c1d7ed477499/ch-commons-util/src/main/java/com/cloudhopper/commons/util/HexUtil.java#L278-L314
3,638
twitter/cloudhopper-commons
ch-commons-util/src/main/java/com/cloudhopper/commons/util/ManagementUtil.java
ManagementUtil.getMBeanServerId
public static String getMBeanServerId(final MBeanServer aMBeanServer) { String serverId = null; final String SERVER_DELEGATE = "JMImplementation:type=MBeanServerDelegate"; final String MBEAN_SERVER_ID_KEY = "MBeanServerId"; try { ObjectName delegateObjName = new ObjectName(SE...
java
public static String getMBeanServerId(final MBeanServer aMBeanServer) { String serverId = null; final String SERVER_DELEGATE = "JMImplementation:type=MBeanServerDelegate"; final String MBEAN_SERVER_ID_KEY = "MBeanServerId"; try { ObjectName delegateObjName = new ObjectName(SE...
[ "public", "static", "String", "getMBeanServerId", "(", "final", "MBeanServer", "aMBeanServer", ")", "{", "String", "serverId", "=", "null", ";", "final", "String", "SERVER_DELEGATE", "=", "\"JMImplementation:type=MBeanServerDelegate\"", ";", "final", "String", "MBEAN_SE...
Get the MBeanServerId of Agent ID for the provided MBeanServer. @param aMBeanServer MBeanServer whose Server ID/Agent ID is desired. @return MBeanServerId/Agent ID of provided MBeanServer.
[ "Get", "the", "MBeanServerId", "of", "Agent", "ID", "for", "the", "provided", "MBeanServer", "." ]
b5bc397dbec4537e8149e7ec0733c1d7ed477499
https://github.com/twitter/cloudhopper-commons/blob/b5bc397dbec4537e8149e7ec0733c1d7ed477499/ch-commons-util/src/main/java/com/cloudhopper/commons/util/ManagementUtil.java#L37-L57
3,639
twitter/cloudhopper-commons
ch-commons-util/src/main/java/com/cloudhopper/commons/util/FastByteArrayOutputStream.java
FastByteArrayOutputStream.addBuffer
protected void addBuffer() { if (buffers == null) { buffers = new LinkedList<byte[]>(); } buffers.addLast(buffer); buffer = new byte[blockSize]; size += index; index = 0; }
java
protected void addBuffer() { if (buffers == null) { buffers = new LinkedList<byte[]>(); } buffers.addLast(buffer); buffer = new byte[blockSize]; size += index; index = 0; }
[ "protected", "void", "addBuffer", "(", ")", "{", "if", "(", "buffers", "==", "null", ")", "{", "buffers", "=", "new", "LinkedList", "<", "byte", "[", "]", ">", "(", ")", ";", "}", "buffers", ".", "addLast", "(", "buffer", ")", ";", "buffer", "=", ...
Create a new buffer and store the current one in linked list
[ "Create", "a", "new", "buffer", "and", "store", "the", "current", "one", "in", "linked", "list" ]
b5bc397dbec4537e8149e7ec0733c1d7ed477499
https://github.com/twitter/cloudhopper-commons/blob/b5bc397dbec4537e8149e7ec0733c1d7ed477499/ch-commons-util/src/main/java/com/cloudhopper/commons/util/FastByteArrayOutputStream.java#L264-L274
3,640
twitter/cloudhopper-commons
ch-commons-xbean/src/main/java/com/cloudhopper/commons/xml/XmlParser.java
XmlParser.parse
public synchronized Node parse(String xml) throws IOException, SAXException { ByteArrayInputStream is = new ByteArrayInputStream(xml.getBytes()); return parse(is); }
java
public synchronized Node parse(String xml) throws IOException, SAXException { ByteArrayInputStream is = new ByteArrayInputStream(xml.getBytes()); return parse(is); }
[ "public", "synchronized", "Node", "parse", "(", "String", "xml", ")", "throws", "IOException", ",", "SAXException", "{", "ByteArrayInputStream", "is", "=", "new", "ByteArrayInputStream", "(", "xml", ".", "getBytes", "(", ")", ")", ";", "return", "parse", "(", ...
Parse XML from a String.
[ "Parse", "XML", "from", "a", "String", "." ]
b5bc397dbec4537e8149e7ec0733c1d7ed477499
https://github.com/twitter/cloudhopper-commons/blob/b5bc397dbec4537e8149e7ec0733c1d7ed477499/ch-commons-xbean/src/main/java/com/cloudhopper/commons/xml/XmlParser.java#L221-L224
3,641
twitter/cloudhopper-commons
ch-commons-xbean/src/main/java/com/cloudhopper/commons/xml/XmlParser.java
XmlParser.parse
public synchronized Node parse(File file) throws IOException, SAXException { return parse(new InputSource(file.toURI().toURL().toString())); }
java
public synchronized Node parse(File file) throws IOException, SAXException { return parse(new InputSource(file.toURI().toURL().toString())); }
[ "public", "synchronized", "Node", "parse", "(", "File", "file", ")", "throws", "IOException", ",", "SAXException", "{", "return", "parse", "(", "new", "InputSource", "(", "file", ".", "toURI", "(", ")", ".", "toURL", "(", ")", ".", "toString", "(", ")", ...
Parse XML from File.
[ "Parse", "XML", "from", "File", "." ]
b5bc397dbec4537e8149e7ec0733c1d7ed477499
https://github.com/twitter/cloudhopper-commons/blob/b5bc397dbec4537e8149e7ec0733c1d7ed477499/ch-commons-xbean/src/main/java/com/cloudhopper/commons/xml/XmlParser.java#L229-L231
3,642
twitter/cloudhopper-commons
ch-commons-xbean/src/main/java/com/cloudhopper/commons/xml/XmlParser.java
XmlParser.parse
public synchronized Node parse(InputStream in) throws IOException, SAXException { //_dtd=null; Handler handler = new Handler(); XMLReader reader = _parser.getXMLReader(); reader.setContentHandler(handler); reader.setErrorHandler(handler); reader.setEntityResolver(handler)...
java
public synchronized Node parse(InputStream in) throws IOException, SAXException { //_dtd=null; Handler handler = new Handler(); XMLReader reader = _parser.getXMLReader(); reader.setContentHandler(handler); reader.setErrorHandler(handler); reader.setEntityResolver(handler)...
[ "public", "synchronized", "Node", "parse", "(", "InputStream", "in", ")", "throws", "IOException", ",", "SAXException", "{", "//_dtd=null;", "Handler", "handler", "=", "new", "Handler", "(", ")", ";", "XMLReader", "reader", "=", "_parser", ".", "getXMLReader", ...
Parse XML from InputStream.
[ "Parse", "XML", "from", "InputStream", "." ]
b5bc397dbec4537e8149e7ec0733c1d7ed477499
https://github.com/twitter/cloudhopper-commons/blob/b5bc397dbec4537e8149e7ec0733c1d7ed477499/ch-commons-xbean/src/main/java/com/cloudhopper/commons/xml/XmlParser.java#L236-L249
3,643
twitter/cloudhopper-commons
ch-jetty/src/main/java/com/cloudhopper/jetty/JettyHttpServer.java
JettyHttpServer.start
public void start() throws Exception { // verify server is NOT null if (server == null) { throw new NullPointerException("Internal server instance was null, server not configured perhaps?"); } logger.info("HttpServer [{}] version [{}] using Jetty [{}]", configuration.safeGet...
java
public void start() throws Exception { // verify server is NOT null if (server == null) { throw new NullPointerException("Internal server instance was null, server not configured perhaps?"); } logger.info("HttpServer [{}] version [{}] using Jetty [{}]", configuration.safeGet...
[ "public", "void", "start", "(", ")", "throws", "Exception", "{", "// verify server is NOT null", "if", "(", "server", "==", "null", ")", "{", "throw", "new", "NullPointerException", "(", "\"Internal server instance was null, server not configured perhaps?\"", ")", ";", ...
Starts the HTTP server. If an exception is thrown during startup, Jetty usually still runs, but this method will catch that and make sure it's shutdown before re-throwing the exception. @throws Exception Thrown if there is an error during start
[ "Starts", "the", "HTTP", "server", ".", "If", "an", "exception", "is", "thrown", "during", "startup", "Jetty", "usually", "still", "runs", "but", "this", "method", "will", "catch", "that", "and", "make", "sure", "it", "s", "shutdown", "before", "re", "-", ...
b5bc397dbec4537e8149e7ec0733c1d7ed477499
https://github.com/twitter/cloudhopper-commons/blob/b5bc397dbec4537e8149e7ec0733c1d7ed477499/ch-jetty/src/main/java/com/cloudhopper/jetty/JettyHttpServer.java#L73-L94
3,644
twitter/cloudhopper-commons
ch-jetty/src/main/java/com/cloudhopper/jetty/JettyHttpServer.java
JettyHttpServer.stop
public void stop() throws Exception { // verify server isn't null if (server == null) { throw new NullPointerException("Internal server instance was null, server already stopped perhaps?"); } logger.info("HttpServer [{}] on [{}] stopping...", configuration.safeGetNam...
java
public void stop() throws Exception { // verify server isn't null if (server == null) { throw new NullPointerException("Internal server instance was null, server already stopped perhaps?"); } logger.info("HttpServer [{}] on [{}] stopping...", configuration.safeGetNam...
[ "public", "void", "stop", "(", ")", "throws", "Exception", "{", "// verify server isn't null", "if", "(", "server", "==", "null", ")", "{", "throw", "new", "NullPointerException", "(", "\"Internal server instance was null, server already stopped perhaps?\"", ")", ";", "...
Stops the HTTP server. @throws Exception Thrown if there is an error during stop
[ "Stops", "the", "HTTP", "server", "." ]
b5bc397dbec4537e8149e7ec0733c1d7ed477499
https://github.com/twitter/cloudhopper-commons/blob/b5bc397dbec4537e8149e7ec0733c1d7ed477499/ch-jetty/src/main/java/com/cloudhopper/jetty/JettyHttpServer.java#L100-L111
3,645
twitter/cloudhopper-commons
ch-jetty/src/main/java/com/cloudhopper/jetty/JettyHttpServer.java
JettyHttpServer.addServlet
public void addServlet(Servlet servlet, String uri) { // create a holder and then add it to the mapping ServletHolder servletHolder = new ServletHolder(servlet); rootServletContext.addServlet(servletHolder, uri); }
java
public void addServlet(Servlet servlet, String uri) { // create a holder and then add it to the mapping ServletHolder servletHolder = new ServletHolder(servlet); rootServletContext.addServlet(servletHolder, uri); }
[ "public", "void", "addServlet", "(", "Servlet", "servlet", ",", "String", "uri", ")", "{", "// create a holder and then add it to the mapping", "ServletHolder", "servletHolder", "=", "new", "ServletHolder", "(", "servlet", ")", ";", "rootServletContext", ".", "addServle...
Adds a servlet to this server. @param servlet The servlet to add @param uri The uri mapping (relative to root context /) to trigger this servlet to be executed. Wildcards are permitted.
[ "Adds", "a", "servlet", "to", "this", "server", "." ]
b5bc397dbec4537e8149e7ec0733c1d7ed477499
https://github.com/twitter/cloudhopper-commons/blob/b5bc397dbec4537e8149e7ec0733c1d7ed477499/ch-jetty/src/main/java/com/cloudhopper/jetty/JettyHttpServer.java#L134-L138
3,646
twitter/cloudhopper-commons
ch-jetty/src/main/java/com/cloudhopper/jetty/JettyHttpServer.java
JettyHttpServer.getMaxQueuedConnections
public int getMaxQueuedConnections() { return getThreadPool() == null ? -1 : ((getThreadPool().getQueue() instanceof ArrayBlockingQueue) ? ((ArrayBlockingQueue)getThreadPool().getQueue()).size() + ((ArrayBlockingQueue)getThreadPool().getQueue()).remainingCapacity() : -1); }
java
public int getMaxQueuedConnections() { return getThreadPool() == null ? -1 : ((getThreadPool().getQueue() instanceof ArrayBlockingQueue) ? ((ArrayBlockingQueue)getThreadPool().getQueue()).size() + ((ArrayBlockingQueue)getThreadPool().getQueue()).remainingCapacity() : -1); }
[ "public", "int", "getMaxQueuedConnections", "(", ")", "{", "return", "getThreadPool", "(", ")", "==", "null", "?", "-", "1", ":", "(", "(", "getThreadPool", "(", ")", ".", "getQueue", "(", ")", "instanceof", "ArrayBlockingQueue", ")", "?", "(", "(", "Arr...
this should only be used as an estimate
[ "this", "should", "only", "be", "used", "as", "an", "estimate" ]
b5bc397dbec4537e8149e7ec0733c1d7ed477499
https://github.com/twitter/cloudhopper-commons/blob/b5bc397dbec4537e8149e7ec0733c1d7ed477499/ch-jetty/src/main/java/com/cloudhopper/jetty/JettyHttpServer.java#L198-L203
3,647
twitter/cloudhopper-commons
ch-commons-util/src/main/java/com/cloudhopper/commons/util/CompressionUtil.java
CompressionUtil.compress
public static File compress(File sourceFile, String algorithm, boolean deleteSourceFileAfterCompressed) throws FileAlreadyExistsException, IOException { return compress(sourceFile, sourceFile.getParentFile(), algorithm, deleteSourceFileAfterCompressed); }
java
public static File compress(File sourceFile, String algorithm, boolean deleteSourceFileAfterCompressed) throws FileAlreadyExistsException, IOException { return compress(sourceFile, sourceFile.getParentFile(), algorithm, deleteSourceFileAfterCompressed); }
[ "public", "static", "File", "compress", "(", "File", "sourceFile", ",", "String", "algorithm", ",", "boolean", "deleteSourceFileAfterCompressed", ")", "throws", "FileAlreadyExistsException", ",", "IOException", "{", "return", "compress", "(", "sourceFile", ",", "sourc...
Compresses the source file using a variety of supported compression algorithms. This method will create a target file in the same directory as the source file and will append a file extension matching the compression algorithm used. For example, using "gzip" will mean a source file of "app.log" would be compressed to...
[ "Compresses", "the", "source", "file", "using", "a", "variety", "of", "supported", "compression", "algorithms", ".", "This", "method", "will", "create", "a", "target", "file", "in", "the", "same", "directory", "as", "the", "source", "file", "and", "will", "a...
b5bc397dbec4537e8149e7ec0733c1d7ed477499
https://github.com/twitter/cloudhopper-commons/blob/b5bc397dbec4537e8149e7ec0733c1d7ed477499/ch-commons-util/src/main/java/com/cloudhopper/commons/util/CompressionUtil.java#L162-L164
3,648
twitter/cloudhopper-commons
ch-commons-util/src/main/java/com/cloudhopper/commons/util/CompressionUtil.java
CompressionUtil.compress
public static File compress(File sourceFile, File targetDir, String algorithm, boolean deleteSourceFileAfterCompressed) throws FileAlreadyExistsException, IOException { // make sure the destination directory is a directory if (!targetDir.isDirectory()) { throw new IOException("Cannot compres...
java
public static File compress(File sourceFile, File targetDir, String algorithm, boolean deleteSourceFileAfterCompressed) throws FileAlreadyExistsException, IOException { // make sure the destination directory is a directory if (!targetDir.isDirectory()) { throw new IOException("Cannot compres...
[ "public", "static", "File", "compress", "(", "File", "sourceFile", ",", "File", "targetDir", ",", "String", "algorithm", ",", "boolean", "deleteSourceFileAfterCompressed", ")", "throws", "FileAlreadyExistsException", ",", "IOException", "{", "// make sure the destination ...
Compresses the source file using a variety of supported compression algorithms. This method will create a destination file in the destination directory and will append a file extension matching the compression algorithm used. For example, using "gzip" will mean a source file of "app.log" would be compressed to "app.l...
[ "Compresses", "the", "source", "file", "using", "a", "variety", "of", "supported", "compression", "algorithms", ".", "This", "method", "will", "create", "a", "destination", "file", "in", "the", "destination", "directory", "and", "will", "append", "a", "file", ...
b5bc397dbec4537e8149e7ec0733c1d7ed477499
https://github.com/twitter/cloudhopper-commons/blob/b5bc397dbec4537e8149e7ec0733c1d7ed477499/ch-commons-util/src/main/java/com/cloudhopper/commons/util/CompressionUtil.java#L187-L207
3,649
twitter/cloudhopper-commons
ch-commons-util/src/main/java/com/cloudhopper/commons/util/CompressionUtil.java
CompressionUtil.uncompress
public static File uncompress(File sourceFile, boolean deleteSourceFileAfterUncompressed) throws FileAlreadyExistsException, IOException { return uncompress(sourceFile, sourceFile.getParentFile(), deleteSourceFileAfterUncompressed); }
java
public static File uncompress(File sourceFile, boolean deleteSourceFileAfterUncompressed) throws FileAlreadyExistsException, IOException { return uncompress(sourceFile, sourceFile.getParentFile(), deleteSourceFileAfterUncompressed); }
[ "public", "static", "File", "uncompress", "(", "File", "sourceFile", ",", "boolean", "deleteSourceFileAfterUncompressed", ")", "throws", "FileAlreadyExistsException", ",", "IOException", "{", "return", "uncompress", "(", "sourceFile", ",", "sourceFile", ".", "getParentF...
Uncompresses the source file using a variety of supported compression algorithms. This method will create a file in the same directory as the source file by stripping the compression algorithm's file extension from the source filename. For example, using "gzip" will mean a source file of "app.log.gz" would be uncompr...
[ "Uncompresses", "the", "source", "file", "using", "a", "variety", "of", "supported", "compression", "algorithms", ".", "This", "method", "will", "create", "a", "file", "in", "the", "same", "directory", "as", "the", "source", "file", "by", "stripping", "the", ...
b5bc397dbec4537e8149e7ec0733c1d7ed477499
https://github.com/twitter/cloudhopper-commons/blob/b5bc397dbec4537e8149e7ec0733c1d7ed477499/ch-commons-util/src/main/java/com/cloudhopper/commons/util/CompressionUtil.java#L227-L229
3,650
twitter/cloudhopper-commons
ch-commons-util/src/main/java/com/cloudhopper/commons/util/CompressionUtil.java
CompressionUtil.uncompress
public static File uncompress(File sourceFile, File targetDir, boolean deleteSourceFileAfterUncompressed) throws FileAlreadyExistsException, IOException { // // figure out compression algorithm used by its extension // String fileExt = FileUtil.parseFileExtension(sourceFile.getName()); ...
java
public static File uncompress(File sourceFile, File targetDir, boolean deleteSourceFileAfterUncompressed) throws FileAlreadyExistsException, IOException { // // figure out compression algorithm used by its extension // String fileExt = FileUtil.parseFileExtension(sourceFile.getName()); ...
[ "public", "static", "File", "uncompress", "(", "File", "sourceFile", ",", "File", "targetDir", ",", "boolean", "deleteSourceFileAfterUncompressed", ")", "throws", "FileAlreadyExistsException", ",", "IOException", "{", "//", "// figure out compression algorithm used by its ext...
Uncompresses the source file using a variety of supported compression algorithms. This method will create a file in the target directory by stripping the compression algorithm's file extension from the source filename. For example, using "gzip" will mean a source file of "app.log.gz" would be uncompressed to "app.log...
[ "Uncompresses", "the", "source", "file", "using", "a", "variety", "of", "supported", "compression", "algorithms", ".", "This", "method", "will", "create", "a", "file", "in", "the", "target", "directory", "by", "stripping", "the", "compression", "algorithm", "s",...
b5bc397dbec4537e8149e7ec0733c1d7ed477499
https://github.com/twitter/cloudhopper-commons/blob/b5bc397dbec4537e8149e7ec0733c1d7ed477499/ch-commons-util/src/main/java/com/cloudhopper/commons/util/CompressionUtil.java#L251-L286
3,651
twitter/cloudhopper-commons
ch-commons-gsm/src/main/java/com/cloudhopper/commons/gsm/TypeOfAddress.java
TypeOfAddress.toByte
public static byte toByte(TypeOfAddress toa) { byte b = 0; if (toa.getTon() != null) { b |= ( toa.getTon().toInt() << 0 ); } if (toa.getNpi() != null) { b |= ( toa.getNpi().toInt() << 4 ); } b |= ( 1 << 7 ); return b; }
java
public static byte toByte(TypeOfAddress toa) { byte b = 0; if (toa.getTon() != null) { b |= ( toa.getTon().toInt() << 0 ); } if (toa.getNpi() != null) { b |= ( toa.getNpi().toInt() << 4 ); } b |= ( 1 << 7 ); return b; }
[ "public", "static", "byte", "toByte", "(", "TypeOfAddress", "toa", ")", "{", "byte", "b", "=", "0", ";", "if", "(", "toa", ".", "getTon", "(", ")", "!=", "null", ")", "{", "b", "|=", "(", "toa", ".", "getTon", "(", ")", ".", "toInt", "(", ")", ...
To a GSM-encoded type of address byte. @return The byte representing a type of address
[ "To", "a", "GSM", "-", "encoded", "type", "of", "address", "byte", "." ]
b5bc397dbec4537e8149e7ec0733c1d7ed477499
https://github.com/twitter/cloudhopper-commons/blob/b5bc397dbec4537e8149e7ec0733c1d7ed477499/ch-commons-gsm/src/main/java/com/cloudhopper/commons/gsm/TypeOfAddress.java#L67-L77
3,652
twitter/cloudhopper-commons
ch-commons-gsm/src/main/java/com/cloudhopper/commons/gsm/TypeOfAddress.java
TypeOfAddress.valueOf
public static TypeOfAddress valueOf(byte b) { // bits 0-3 are the ton (shift over 0, then only the first 4 bits) int ton = (b & 0x0F); // bits 4-7 are the npi (shift over 4, then only the first 3 bits) int npi = ((b >> 4) & 0x07); // create our type of address now return ...
java
public static TypeOfAddress valueOf(byte b) { // bits 0-3 are the ton (shift over 0, then only the first 4 bits) int ton = (b & 0x0F); // bits 4-7 are the npi (shift over 4, then only the first 3 bits) int npi = ((b >> 4) & 0x07); // create our type of address now return ...
[ "public", "static", "TypeOfAddress", "valueOf", "(", "byte", "b", ")", "{", "// bits 0-3 are the ton (shift over 0, then only the first 4 bits)", "int", "ton", "=", "(", "b", "&", "0x0F", ")", ";", "// bits 4-7 are the npi (shift over 4, then only the first 3 bits)", "int", ...
Creates a TypeOfAddress from a GSM-encoded type of address byte. @return
[ "Creates", "a", "TypeOfAddress", "from", "a", "GSM", "-", "encoded", "type", "of", "address", "byte", "." ]
b5bc397dbec4537e8149e7ec0733c1d7ed477499
https://github.com/twitter/cloudhopper-commons/blob/b5bc397dbec4537e8149e7ec0733c1d7ed477499/ch-commons-gsm/src/main/java/com/cloudhopper/commons/gsm/TypeOfAddress.java#L83-L90
3,653
mojohaus/webstart
webstart-maven-plugin/src/main/java/org/codehaus/mojo/webstart/sign/DefaultSignTool.java
DefaultSignTool.infoOrDebug
private void infoOrDebug( boolean info, String msg ) { if ( info ) { getLogger().info( msg ); } else { getLogger().debug( msg ); } }
java
private void infoOrDebug( boolean info, String msg ) { if ( info ) { getLogger().info( msg ); } else { getLogger().debug( msg ); } }
[ "private", "void", "infoOrDebug", "(", "boolean", "info", ",", "String", "msg", ")", "{", "if", "(", "info", ")", "{", "getLogger", "(", ")", ".", "info", "(", "msg", ")", ";", "}", "else", "{", "getLogger", "(", ")", ".", "debug", "(", "msg", ")...
Log a message as info or debug. @param info if set to true, log as info(), otherwise as debug() @param msg message to log
[ "Log", "a", "message", "as", "info", "or", "debug", "." ]
38fdd1d21f063f21716cfcd61ebeabd963487576
https://github.com/mojohaus/webstart/blob/38fdd1d21f063f21716cfcd61ebeabd963487576/webstart-maven-plugin/src/main/java/org/codehaus/mojo/webstart/sign/DefaultSignTool.java#L288-L298
3,654
mojohaus/webstart
webstart-jnlp-servlet/src/main/java/jnlp/sample/servlet/DownloadRequest.java
DownloadRequest.getStringList
static private String[] getStringList( String str ) { if ( str == null ) { return null; } List<String> list = new ArrayList<>(); int i = 0; int length = str.length(); StringBuffer sb = null; while ( i < length ) { char c...
java
static private String[] getStringList( String str ) { if ( str == null ) { return null; } List<String> list = new ArrayList<>(); int i = 0; int length = str.length(); StringBuffer sb = null; while ( i < length ) { char c...
[ "static", "private", "String", "[", "]", "getStringList", "(", "String", "str", ")", "{", "if", "(", "str", "==", "null", ")", "{", "return", "null", ";", "}", "List", "<", "String", ">", "list", "=", "new", "ArrayList", "<>", "(", ")", ";", "int",...
Converts a space delimitered string to a list of strings
[ "Converts", "a", "space", "delimitered", "string", "to", "a", "list", "of", "strings" ]
38fdd1d21f063f21716cfcd61ebeabd963487576
https://github.com/mojohaus/webstart/blob/38fdd1d21f063f21716cfcd61ebeabd963487576/webstart-jnlp-servlet/src/main/java/jnlp/sample/servlet/DownloadRequest.java#L188-L244
3,655
mojohaus/webstart
webstart-maven-plugin/src/main/java/org/codehaus/mojo/webstart/ResolvedJarResource.java
ResolvedJarResource.getHrefValue
public String getHrefValue() { String result; if ( hrefValue == null && getArtifact() != null ) { // use default value result = getArtifact().getFile().getName(); } else { // use customized value result = hrefValue; ...
java
public String getHrefValue() { String result; if ( hrefValue == null && getArtifact() != null ) { // use default value result = getArtifact().getFile().getName(); } else { // use customized value result = hrefValue; ...
[ "public", "String", "getHrefValue", "(", ")", "{", "String", "result", ";", "if", "(", "hrefValue", "==", "null", "&&", "getArtifact", "(", ")", "!=", "null", ")", "{", "// use default value", "result", "=", "getArtifact", "(", ")", ".", "getFile", "(", ...
Returns the value that should be output for this jar in the href attribute of the jar resource element in the generated JNLP file. If not set explicitly, this defaults to the file name of the underlying artifact. @return The href attribute to be output for this jar resource in the generated JNLP file.
[ "Returns", "the", "value", "that", "should", "be", "output", "for", "this", "jar", "in", "the", "href", "attribute", "of", "the", "jar", "resource", "element", "in", "the", "generated", "JNLP", "file", ".", "If", "not", "set", "explicitly", "this", "defaul...
38fdd1d21f063f21716cfcd61ebeabd963487576
https://github.com/mojohaus/webstart/blob/38fdd1d21f063f21716cfcd61ebeabd963487576/webstart-maven-plugin/src/main/java/org/codehaus/mojo/webstart/ResolvedJarResource.java#L126-L140
3,656
mojohaus/webstart
webstart-maven-plugin/src/main/java/org/codehaus/mojo/webstart/generator/AbstractGenerator.java
AbstractGenerator.generate
public final void generate() throws Exception { VelocityContext context = createAndPopulateContext(); Writer writer = WriterFactory.newWriter( config.getOutputFile(), config.getEncoding() ); try { velocityTemplate.merge( context, writer ); writer...
java
public final void generate() throws Exception { VelocityContext context = createAndPopulateContext(); Writer writer = WriterFactory.newWriter( config.getOutputFile(), config.getEncoding() ); try { velocityTemplate.merge( context, writer ); writer...
[ "public", "final", "void", "generate", "(", ")", "throws", "Exception", "{", "VelocityContext", "context", "=", "createAndPopulateContext", "(", ")", ";", "Writer", "writer", "=", "WriterFactory", ".", "newWriter", "(", "config", ".", "getOutputFile", "(", ")", ...
Generate the JNLP file. @throws Exception TODO
[ "Generate", "the", "JNLP", "file", "." ]
38fdd1d21f063f21716cfcd61ebeabd963487576
https://github.com/mojohaus/webstart/blob/38fdd1d21f063f21716cfcd61ebeabd963487576/webstart-maven-plugin/src/main/java/org/codehaus/mojo/webstart/generator/AbstractGenerator.java#L152-L174
3,657
mojohaus/webstart
webstart-maven-plugin/src/main/java/org/codehaus/mojo/webstart/generator/AbstractGenerator.java
AbstractGenerator.createAndPopulateContext
protected VelocityContext createAndPopulateContext() { VelocityContext context = new VelocityContext(); context.put( "dependencies", getDependenciesText() ); context.put( "arguments", getArgumentsText() ); // Note: properties that contain dots will not be properly parsed by Veloci...
java
protected VelocityContext createAndPopulateContext() { VelocityContext context = new VelocityContext(); context.put( "dependencies", getDependenciesText() ); context.put( "arguments", getArgumentsText() ); // Note: properties that contain dots will not be properly parsed by Veloci...
[ "protected", "VelocityContext", "createAndPopulateContext", "(", ")", "{", "VelocityContext", "context", "=", "new", "VelocityContext", "(", ")", ";", "context", ".", "put", "(", "\"dependencies\"", ",", "getDependenciesText", "(", ")", ")", ";", "context", ".", ...
Creates a Velocity context and populates it with replacement values for our pre-defined placeholders. @return Returns a velocity context with system and maven properties added
[ "Creates", "a", "Velocity", "context", "and", "populates", "it", "with", "replacement", "values", "for", "our", "pre", "-", "defined", "placeholders", "." ]
38fdd1d21f063f21716cfcd61ebeabd963487576
https://github.com/mojohaus/webstart/blob/38fdd1d21f063f21716cfcd61ebeabd963487576/webstart-maven-plugin/src/main/java/org/codehaus/mojo/webstart/generator/AbstractGenerator.java#L190-L241
3,658
mojohaus/webstart
webstart-maven-plugin/src/main/java/org/codehaus/mojo/webstart/generator/AbstractGenerator.java
AbstractGenerator.dateToExplicitTimestamp
private String dateToExplicitTimestamp( Date date ) { DateFormat df = new SimpleDateFormat( "yyyy-MM-dd HH:mm:ssZ" ); return "TS: " + df.format( date ); }
java
private String dateToExplicitTimestamp( Date date ) { DateFormat df = new SimpleDateFormat( "yyyy-MM-dd HH:mm:ssZ" ); return "TS: " + df.format( date ); }
[ "private", "String", "dateToExplicitTimestamp", "(", "Date", "date", ")", "{", "DateFormat", "df", "=", "new", "SimpleDateFormat", "(", "\"yyyy-MM-dd HH:mm:ssZ\"", ")", ";", "return", "\"TS: \"", "+", "df", ".", "format", "(", "date", ")", ";", "}" ]
Converts a given date to an explicit timestamp string in local time zone. @param date a timestamp to convert. @return a string representing a timestamp.
[ "Converts", "a", "given", "date", "to", "an", "explicit", "timestamp", "string", "in", "local", "time", "zone", "." ]
38fdd1d21f063f21716cfcd61ebeabd963487576
https://github.com/mojohaus/webstart/blob/38fdd1d21f063f21716cfcd61ebeabd963487576/webstart-maven-plugin/src/main/java/org/codehaus/mojo/webstart/generator/AbstractGenerator.java#L264-L268
3,659
mojohaus/webstart
webstart-maven-plugin/src/main/java/org/codehaus/mojo/webstart/generator/AbstractGenerator.java
AbstractGenerator.dateToExplicitTimestampUTC
private String dateToExplicitTimestampUTC( Date date ) { DateFormat df = new SimpleDateFormat( "yyyy-MM-dd HH:mm:ss" ); df.setTimeZone( TimeZone.getTimeZone( "UTC" ) ); return "TS: " + df.format( date ) + "Z"; }
java
private String dateToExplicitTimestampUTC( Date date ) { DateFormat df = new SimpleDateFormat( "yyyy-MM-dd HH:mm:ss" ); df.setTimeZone( TimeZone.getTimeZone( "UTC" ) ); return "TS: " + df.format( date ) + "Z"; }
[ "private", "String", "dateToExplicitTimestampUTC", "(", "Date", "date", ")", "{", "DateFormat", "df", "=", "new", "SimpleDateFormat", "(", "\"yyyy-MM-dd HH:mm:ss\"", ")", ";", "df", ".", "setTimeZone", "(", "TimeZone", ".", "getTimeZone", "(", "\"UTC\"", ")", ")...
Converts a given date to an explicit timestamp string in UTC time zone. @param date a timestamp to convert. @return a string representing a timestamp.
[ "Converts", "a", "given", "date", "to", "an", "explicit", "timestamp", "string", "in", "UTC", "time", "zone", "." ]
38fdd1d21f063f21716cfcd61ebeabd963487576
https://github.com/mojohaus/webstart/blob/38fdd1d21f063f21716cfcd61ebeabd963487576/webstart-maven-plugin/src/main/java/org/codehaus/mojo/webstart/generator/AbstractGenerator.java#L276-L281
3,660
mojohaus/webstart
webstart-jnlp-servlet/src/main/java/jnlp/sample/servlet/JarDiffHandler.java
JarDiffHandler.getJarDiffEntry
public synchronized DownloadResponse getJarDiffEntry( ResourceCatalog catalog, DownloadRequest dreq, JnlpResource res ) { if ( dreq.getCurrentVersionId() == null ) { return null; } // check whether the request is ...
java
public synchronized DownloadResponse getJarDiffEntry( ResourceCatalog catalog, DownloadRequest dreq, JnlpResource res ) { if ( dreq.getCurrentVersionId() == null ) { return null; } // check whether the request is ...
[ "public", "synchronized", "DownloadResponse", "getJarDiffEntry", "(", "ResourceCatalog", "catalog", ",", "DownloadRequest", "dreq", ",", "JnlpResource", "res", ")", "{", "if", "(", "dreq", ".", "getCurrentVersionId", "(", ")", "==", "null", ")", "{", "return", "...
Returns a JarDiff for the given request @param catalog TODO @param dreq TODO @param res TODO @return TODO
[ "Returns", "a", "JarDiff", "for", "the", "given", "request" ]
38fdd1d21f063f21716cfcd61ebeabd963487576
https://github.com/mojohaus/webstart/blob/38fdd1d21f063f21716cfcd61ebeabd963487576/webstart-jnlp-servlet/src/main/java/jnlp/sample/servlet/JarDiffHandler.java#L207-L254
3,661
mojohaus/webstart
webstart-jnlp-servlet/src/main/java/jnlp/sample/servlet/JarDiffHandler.java
JarDiffHandler.download
private boolean download( URL target, File file ) { _log.addDebug( "JarDiffHandler: Doing download" ); boolean ret = true; boolean delete = false; // use bufferedstream for better performance BufferedInputStream in = null; BufferedOutputStream out = null; t...
java
private boolean download( URL target, File file ) { _log.addDebug( "JarDiffHandler: Doing download" ); boolean ret = true; boolean delete = false; // use bufferedstream for better performance BufferedInputStream in = null; BufferedOutputStream out = null; t...
[ "private", "boolean", "download", "(", "URL", "target", ",", "File", "file", ")", "{", "_log", ".", "addDebug", "(", "\"JarDiffHandler: Doing download\"", ")", ";", "boolean", "ret", "=", "true", ";", "boolean", "delete", "=", "false", ";", "// use bufferedst...
Download resource to the given file
[ "Download", "resource", "to", "the", "given", "file" ]
38fdd1d21f063f21716cfcd61ebeabd963487576
https://github.com/mojohaus/webstart/blob/38fdd1d21f063f21716cfcd61ebeabd963487576/webstart-jnlp-servlet/src/main/java/jnlp/sample/servlet/JarDiffHandler.java#L306-L376
3,662
mojohaus/webstart
webstart-jnlp-servlet/src/main/java/jnlp/sample/servlet/JarDiffHandler.java
JarDiffHandler.getRealPath
private String getRealPath( String path ) throws IOException { URL fileURL = _servletContext.getResource( path ); File tempDir = (File) _servletContext.getAttribute( "javax.servlet.context.tempdir" ); // download file into temp dir if ( fileURL != null ) { ...
java
private String getRealPath( String path ) throws IOException { URL fileURL = _servletContext.getResource( path ); File tempDir = (File) _servletContext.getAttribute( "javax.servlet.context.tempdir" ); // download file into temp dir if ( fileURL != null ) { ...
[ "private", "String", "getRealPath", "(", "String", "path", ")", "throws", "IOException", "{", "URL", "fileURL", "=", "_servletContext", ".", "getResource", "(", "path", ")", ";", "File", "tempDir", "=", "(", "File", ")", "_servletContext", ".", "getAttribute",...
so it can be used to generate jardiff
[ "so", "it", "can", "be", "used", "to", "generate", "jardiff" ]
38fdd1d21f063f21716cfcd61ebeabd963487576
https://github.com/mojohaus/webstart/blob/38fdd1d21f063f21716cfcd61ebeabd963487576/webstart-jnlp-servlet/src/main/java/jnlp/sample/servlet/JarDiffHandler.java#L381-L400
3,663
mojohaus/webstart
webstart-jnlp-servlet/src/main/java/jnlp/sample/servlet/Logger.java
Logger.addFatal
public void addFatal( String key, Throwable throwable ) { logEvent( FATAL, getString( key ), throwable ); }
java
public void addFatal( String key, Throwable throwable ) { logEvent( FATAL, getString( key ), throwable ); }
[ "public", "void", "addFatal", "(", "String", "key", ",", "Throwable", "throwable", ")", "{", "logEvent", "(", "FATAL", ",", "getString", "(", "key", ")", ",", "throwable", ")", ";", "}" ]
Logging API. Fatal, Warning, and Informational are localized
[ "Logging", "API", ".", "Fatal", "Warning", "and", "Informational", "are", "localized" ]
38fdd1d21f063f21716cfcd61ebeabd963487576
https://github.com/mojohaus/webstart/blob/38fdd1d21f063f21716cfcd61ebeabd963487576/webstart-jnlp-servlet/src/main/java/jnlp/sample/servlet/Logger.java#L138-L141
3,664
mojohaus/webstart
webstart-jnlp-servlet/src/main/java/jnlp/sample/servlet/Logger.java
Logger.getString
private String getString( String key ) { try { return _resources.getString( key ); } catch ( MissingResourceException mre ) { return "Missing resource for: " + key; } }
java
private String getString( String key ) { try { return _resources.getString( key ); } catch ( MissingResourceException mre ) { return "Missing resource for: " + key; } }
[ "private", "String", "getString", "(", "String", "key", ")", "{", "try", "{", "return", "_resources", ".", "getString", "(", "key", ")", ";", "}", "catch", "(", "MissingResourceException", "mre", ")", "{", "return", "\"Missing resource for: \"", "+", "key", ...
Returns a string from the resources
[ "Returns", "a", "string", "from", "the", "resources" ]
38fdd1d21f063f21716cfcd61ebeabd963487576
https://github.com/mojohaus/webstart/blob/38fdd1d21f063f21716cfcd61ebeabd963487576/webstart-jnlp-servlet/src/main/java/jnlp/sample/servlet/Logger.java#L216-L226
3,665
mojohaus/webstart
webstart-jnlp-servlet/src/main/java/jnlp/sample/servlet/Logger.java
Logger.applyPattern
private String applyPattern( String key, Object[] messageArguments ) { String message = getString( key ); // MessageFormat formatter = new MessageFormat( message ); String output = MessageFormat.format( message, messageArguments ); return output; }
java
private String applyPattern( String key, Object[] messageArguments ) { String message = getString( key ); // MessageFormat formatter = new MessageFormat( message ); String output = MessageFormat.format( message, messageArguments ); return output; }
[ "private", "String", "applyPattern", "(", "String", "key", ",", "Object", "[", "]", "messageArguments", ")", "{", "String", "message", "=", "getString", "(", "key", ")", ";", "// MessageFormat formatter = new MessageFormat( message );", "String", "output", "=",...
Helper function that applies the messageArguments to a message from the resource object
[ "Helper", "function", "that", "applies", "the", "messageArguments", "to", "a", "message", "from", "the", "resource", "object" ]
38fdd1d21f063f21716cfcd61ebeabd963487576
https://github.com/mojohaus/webstart/blob/38fdd1d21f063f21716cfcd61ebeabd963487576/webstart-jnlp-servlet/src/main/java/jnlp/sample/servlet/Logger.java#L249-L255
3,666
mojohaus/webstart
webstart-jnlp-servlet/src/main/java/jnlp/sample/servlet/Logger.java
Logger.logEvent
private synchronized void logEvent( int level, String string, Throwable throwable ) { // Check if the event should be logged if ( level > _loggingLevel ) { return; } if ( _logFile != null ) { // No logfile specified, log using servlet context ...
java
private synchronized void logEvent( int level, String string, Throwable throwable ) { // Check if the event should be logged if ( level > _loggingLevel ) { return; } if ( _logFile != null ) { // No logfile specified, log using servlet context ...
[ "private", "synchronized", "void", "logEvent", "(", "int", "level", ",", "String", "string", ",", "Throwable", "throwable", ")", "{", "// Check if the event should be logged", "if", "(", "level", ">", "_loggingLevel", ")", "{", "return", ";", "}", "if", "(", "...
The method that actually does the logging
[ "The", "method", "that", "actually", "does", "the", "logging" ]
38fdd1d21f063f21716cfcd61ebeabd963487576
https://github.com/mojohaus/webstart/blob/38fdd1d21f063f21716cfcd61ebeabd963487576/webstart-jnlp-servlet/src/main/java/jnlp/sample/servlet/Logger.java#L258-L298
3,667
mojohaus/webstart
webstart-maven-plugin/src/main/java/org/codehaus/mojo/webstart/util/DefaultArtifactUtil.java
DefaultArtifactUtil.artifactContainsClass
public boolean artifactContainsClass( Artifact artifact, final String mainClass ) throws MojoExecutionException { boolean containsClass = true; // JarArchiver.grabFilesAndDirs() URL url; try { url = artifact.getFile().toURI().toURL(); } ...
java
public boolean artifactContainsClass( Artifact artifact, final String mainClass ) throws MojoExecutionException { boolean containsClass = true; // JarArchiver.grabFilesAndDirs() URL url; try { url = artifact.getFile().toURI().toURL(); } ...
[ "public", "boolean", "artifactContainsClass", "(", "Artifact", "artifact", ",", "final", "String", "mainClass", ")", "throws", "MojoExecutionException", "{", "boolean", "containsClass", "=", "true", ";", "// JarArchiver.grabFilesAndDirs()", "URL", "url", ";", "try", "...
Tests if the given fully qualified name exists in the given artifact. @param artifact artifact to test @param mainClass the fully qualified name to find in artifact @return {@code true} if given artifact contains the given fqn, {@code false} otherwise @throws MojoExecutionException if artifact file url is mal formed
[ "Tests", "if", "the", "given", "fully", "qualified", "name", "exists", "in", "the", "given", "artifact", "." ]
38fdd1d21f063f21716cfcd61ebeabd963487576
https://github.com/mojohaus/webstart/blob/38fdd1d21f063f21716cfcd61ebeabd963487576/webstart-maven-plugin/src/main/java/org/codehaus/mojo/webstart/util/DefaultArtifactUtil.java#L202-L267
3,668
mojohaus/webstart
webstart-jnlp-servlet/src/main/java/jnlp/sample/jardiff/JarDiff.java
JarDiff.main
public static void main( String[] args ) throws IOException { boolean diff = true; boolean minimal = true; String outputFile = "out.jardiff"; for ( int counter = 0; counter < args.length; counter++ ) { // for backward compatibilty with 1.0.1/1.0 ...
java
public static void main( String[] args ) throws IOException { boolean diff = true; boolean minimal = true; String outputFile = "out.jardiff"; for ( int counter = 0; counter < args.length; counter++ ) { // for backward compatibilty with 1.0.1/1.0 ...
[ "public", "static", "void", "main", "(", "String", "[", "]", "args", ")", "throws", "IOException", "{", "boolean", "diff", "=", "true", ";", "boolean", "minimal", "=", "true", ";", "String", "outputFile", "=", "\"out.jardiff\"", ";", "for", "(", "int", "...
-creatediff -applydiff -debug -output file
[ "-", "creatediff", "-", "applydiff", "-", "debug", "-", "output", "file" ]
38fdd1d21f063f21716cfcd61ebeabd963487576
https://github.com/mojohaus/webstart/blob/38fdd1d21f063f21716cfcd61ebeabd963487576/webstart-jnlp-servlet/src/main/java/jnlp/sample/jardiff/JarDiff.java#L700-L788
3,669
mojohaus/webstart
webstart-maven-plugin/src/main/java/org/codehaus/mojo/webstart/AbstractJnlpMojo.java
AbstractJnlpMojo.processDependencies
private void processDependencies() throws MojoExecutionException { processDependency( getProject().getArtifact() ); AndArtifactFilter filter = new AndArtifactFilter(); // filter.add( new ScopeArtifactFilter( dependencySet.getScope() ) ); if ( dependencies != null && de...
java
private void processDependencies() throws MojoExecutionException { processDependency( getProject().getArtifact() ); AndArtifactFilter filter = new AndArtifactFilter(); // filter.add( new ScopeArtifactFilter( dependencySet.getScope() ) ); if ( dependencies != null && de...
[ "private", "void", "processDependencies", "(", ")", "throws", "MojoExecutionException", "{", "processDependency", "(", "getProject", "(", ")", ".", "getArtifact", "(", ")", ")", ";", "AndArtifactFilter", "filter", "=", "new", "AndArtifactFilter", "(", ")", ";", ...
Iterate through all the top level and transitive dependencies declared in the project and collect all the runtime scope dependencies for inclusion in the .zip and signing. @throws MojoExecutionException if could not process dependencies
[ "Iterate", "through", "all", "the", "top", "level", "and", "transitive", "dependencies", "declared", "in", "the", "project", "and", "collect", "all", "the", "runtime", "scope", "dependencies", "for", "inclusion", "in", "the", ".", "zip", "and", "signing", "." ...
38fdd1d21f063f21716cfcd61ebeabd963487576
https://github.com/mojohaus/webstart/blob/38fdd1d21f063f21716cfcd61ebeabd963487576/webstart-maven-plugin/src/main/java/org/codehaus/mojo/webstart/AbstractJnlpMojo.java#L493-L521
3,670
mojohaus/webstart
webstart-maven-plugin/src/main/java/org/codehaus/mojo/webstart/AbstractBaseJnlpMojo.java
AbstractBaseJnlpMojo.getResourcesDirectory
protected File getResourcesDirectory() { if ( resourcesDirectory == null ) { resourcesDirectory = new File( getProject().getBasedir(), DEFAULT_RESOURCES_DIR ); } return resourcesDirectory; }
java
protected File getResourcesDirectory() { if ( resourcesDirectory == null ) { resourcesDirectory = new File( getProject().getBasedir(), DEFAULT_RESOURCES_DIR ); } return resourcesDirectory; }
[ "protected", "File", "getResourcesDirectory", "(", ")", "{", "if", "(", "resourcesDirectory", "==", "null", ")", "{", "resourcesDirectory", "=", "new", "File", "(", "getProject", "(", ")", ".", "getBasedir", "(", ")", ",", "DEFAULT_RESOURCES_DIR", ")", ";", ...
Returns the location of the directory containing non-jar resources that are to be included in the JNLP bundle. @return Returns the value of the resourcesDirectory field, never null.
[ "Returns", "the", "location", "of", "the", "directory", "containing", "non", "-", "jar", "resources", "that", "are", "to", "be", "included", "in", "the", "JNLP", "bundle", "." ]
38fdd1d21f063f21716cfcd61ebeabd963487576
https://github.com/mojohaus/webstart/blob/38fdd1d21f063f21716cfcd61ebeabd963487576/webstart-maven-plugin/src/main/java/org/codehaus/mojo/webstart/AbstractBaseJnlpMojo.java#L455-L465
3,671
mojohaus/webstart
webstart-maven-plugin/src/main/java/org/codehaus/mojo/webstart/AbstractBaseJnlpMojo.java
AbstractBaseJnlpMojo.signOrRenameJars
protected void signOrRenameJars() throws MojoExecutionException { if ( sign != null ) { try { ClassLoader loader = getCompileClassLoader(); sign.init( getWorkDirectory(), getLog().isDebugEnabled(), signTool, securityDispatcher, loa...
java
protected void signOrRenameJars() throws MojoExecutionException { if ( sign != null ) { try { ClassLoader loader = getCompileClassLoader(); sign.init( getWorkDirectory(), getLog().isDebugEnabled(), signTool, securityDispatcher, loa...
[ "protected", "void", "signOrRenameJars", "(", ")", "throws", "MojoExecutionException", "{", "if", "(", "sign", "!=", "null", ")", "{", "try", "{", "ClassLoader", "loader", "=", "getCompileClassLoader", "(", ")", ";", "sign", ".", "init", "(", "getWorkDirectory...
If sign is enabled, sign the jars, otherwise rename them into final jars @throws MojoExecutionException if can not sign or rename jars
[ "If", "sign", "is", "enabled", "sign", "the", "jars", "otherwise", "rename", "them", "into", "final", "jars" ]
38fdd1d21f063f21716cfcd61ebeabd963487576
https://github.com/mojohaus/webstart/blob/38fdd1d21f063f21716cfcd61ebeabd963487576/webstart-maven-plugin/src/main/java/org/codehaus/mojo/webstart/AbstractBaseJnlpMojo.java#L666-L728
3,672
mojohaus/webstart
webstart-maven-plugin/src/main/java/org/codehaus/mojo/webstart/AbstractBaseJnlpMojo.java
AbstractBaseJnlpMojo.verboseLog
protected void verboseLog( String msg ) { if ( isVerbose() ) { getLog().info( msg ); } else { getLog().debug( msg ); } }
java
protected void verboseLog( String msg ) { if ( isVerbose() ) { getLog().info( msg ); } else { getLog().debug( msg ); } }
[ "protected", "void", "verboseLog", "(", "String", "msg", ")", "{", "if", "(", "isVerbose", "(", ")", ")", "{", "getLog", "(", ")", ".", "info", "(", "msg", ")", ";", "}", "else", "{", "getLog", "(", ")", ".", "debug", "(", "msg", ")", ";", "}",...
Log as info when verbose or info is enabled, as debug otherwise. @param msg the message to display
[ "Log", "as", "info", "when", "verbose", "or", "info", "is", "enabled", "as", "debug", "otherwise", "." ]
38fdd1d21f063f21716cfcd61ebeabd963487576
https://github.com/mojohaus/webstart/blob/38fdd1d21f063f21716cfcd61ebeabd963487576/webstart-maven-plugin/src/main/java/org/codehaus/mojo/webstart/AbstractBaseJnlpMojo.java#L785-L795
3,673
mojohaus/webstart
webstart-maven-plugin/src/main/java/org/codehaus/mojo/webstart/AbstractBaseJnlpMojo.java
AbstractBaseJnlpMojo.removeExistingSignatures
private int removeExistingSignatures( File workDirectory ) throws MojoExecutionException { getLog().info( "-- Remove existing signatures" ); // cleanup tempDir if exists File tempDir = new File( workDirectory, "temp_extracted_jars" ); ioUtil.removeDirectory( tempDir ); ...
java
private int removeExistingSignatures( File workDirectory ) throws MojoExecutionException { getLog().info( "-- Remove existing signatures" ); // cleanup tempDir if exists File tempDir = new File( workDirectory, "temp_extracted_jars" ); ioUtil.removeDirectory( tempDir ); ...
[ "private", "int", "removeExistingSignatures", "(", "File", "workDirectory", ")", "throws", "MojoExecutionException", "{", "getLog", "(", ")", ".", "info", "(", "\"-- Remove existing signatures\"", ")", ";", "// cleanup tempDir if exists", "File", "tempDir", "=", "new", ...
Removes the signature of the files in the specified directory which satisfy the specified filter. @param workDirectory working directory used to unsign jars @return the number of unsigned jars @throws MojoExecutionException if could not remove signatures
[ "Removes", "the", "signature", "of", "the", "files", "in", "the", "specified", "directory", "which", "satisfy", "the", "specified", "filter", "." ]
38fdd1d21f063f21716cfcd61ebeabd963487576
https://github.com/mojohaus/webstart/blob/38fdd1d21f063f21716cfcd61ebeabd963487576/webstart-maven-plugin/src/main/java/org/codehaus/mojo/webstart/AbstractBaseJnlpMojo.java#L982-L1023
3,674
mojohaus/webstart
webstart-maven-plugin/src/main/java/org/codehaus/mojo/webstart/JnlpDownloadServletMojo.java
JnlpDownloadServletMojo.checkConfiguration
private void checkConfiguration() throws MojoExecutionException { checkDependencyFilenameStrategy(); if ( CollectionUtils.isEmpty( jnlpFiles ) ) { throw new MojoExecutionException( "Configuration error: At least one <jnlpFile> element must be spec...
java
private void checkConfiguration() throws MojoExecutionException { checkDependencyFilenameStrategy(); if ( CollectionUtils.isEmpty( jnlpFiles ) ) { throw new MojoExecutionException( "Configuration error: At least one <jnlpFile> element must be spec...
[ "private", "void", "checkConfiguration", "(", ")", "throws", "MojoExecutionException", "{", "checkDependencyFilenameStrategy", "(", ")", ";", "if", "(", "CollectionUtils", ".", "isEmpty", "(", "jnlpFiles", ")", ")", "{", "throw", "new", "MojoExecutionException", "("...
Confirms that all plugin configuration provided by the user in the pom.xml file is valid. @throws MojoExecutionException if any user configuration is invalid.
[ "Confirms", "that", "all", "plugin", "configuration", "provided", "by", "the", "user", "in", "the", "pom", ".", "xml", "file", "is", "valid", "." ]
38fdd1d21f063f21716cfcd61ebeabd963487576
https://github.com/mojohaus/webstart/blob/38fdd1d21f063f21716cfcd61ebeabd963487576/webstart-maven-plugin/src/main/java/org/codehaus/mojo/webstart/JnlpDownloadServletMojo.java#L235-L311
3,675
mojohaus/webstart
webstart-maven-plugin/src/main/java/org/codehaus/mojo/webstart/JnlpDownloadServletMojo.java
JnlpDownloadServletMojo.checkJnlpFileConfiguration
private void checkJnlpFileConfiguration( JnlpFile jnlpFile ) throws MojoExecutionException { if ( StringUtils.isBlank( jnlpFile.getOutputFilename() ) ) { throw new MojoExecutionException( "Configuration error: An outputFilename must be specified for each ...
java
private void checkJnlpFileConfiguration( JnlpFile jnlpFile ) throws MojoExecutionException { if ( StringUtils.isBlank( jnlpFile.getOutputFilename() ) ) { throw new MojoExecutionException( "Configuration error: An outputFilename must be specified for each ...
[ "private", "void", "checkJnlpFileConfiguration", "(", "JnlpFile", "jnlpFile", ")", "throws", "MojoExecutionException", "{", "if", "(", "StringUtils", ".", "isBlank", "(", "jnlpFile", ".", "getOutputFilename", "(", ")", ")", ")", "{", "throw", "new", "MojoExecution...
Checks the validity of a single jnlpFile configuration element. @param jnlpFile The configuration element to be checked. @throws MojoExecutionException if the config element is invalid.
[ "Checks", "the", "validity", "of", "a", "single", "jnlpFile", "configuration", "element", "." ]
38fdd1d21f063f21716cfcd61ebeabd963487576
https://github.com/mojohaus/webstart/blob/38fdd1d21f063f21716cfcd61ebeabd963487576/webstart-maven-plugin/src/main/java/org/codehaus/mojo/webstart/JnlpDownloadServletMojo.java#L319-L394
3,676
mojohaus/webstart
webstart-maven-plugin/src/main/java/org/codehaus/mojo/webstart/JnlpDownloadServletMojo.java
JnlpDownloadServletMojo.generateVersionXml
private void generateVersionXml( Set<ResolvedJarResource> jarResources ) throws MojoExecutionException { VersionXmlGenerator generator = new VersionXmlGenerator( getEncoding() ); generator.generate( getLibDirectory(), jarResources ); }
java
private void generateVersionXml( Set<ResolvedJarResource> jarResources ) throws MojoExecutionException { VersionXmlGenerator generator = new VersionXmlGenerator( getEncoding() ); generator.generate( getLibDirectory(), jarResources ); }
[ "private", "void", "generateVersionXml", "(", "Set", "<", "ResolvedJarResource", ">", "jarResources", ")", "throws", "MojoExecutionException", "{", "VersionXmlGenerator", "generator", "=", "new", "VersionXmlGenerator", "(", "getEncoding", "(", ")", ")", ";", "generato...
Generates a version.xml file for all the jarResources configured either in jnlpFile elements or in the commonJarResources element. @throws MojoExecutionException if could not generate the xml version file
[ "Generates", "a", "version", ".", "xml", "file", "for", "all", "the", "jarResources", "configured", "either", "in", "jnlpFile", "elements", "or", "in", "the", "commonJarResources", "element", "." ]
38fdd1d21f063f21716cfcd61ebeabd963487576
https://github.com/mojohaus/webstart/blob/38fdd1d21f063f21716cfcd61ebeabd963487576/webstart-maven-plugin/src/main/java/org/codehaus/mojo/webstart/JnlpDownloadServletMojo.java#L643-L649
3,677
mojohaus/webstart
webstart-jnlp-servlet/src/main/java/jnlp/sample/servlet/JnlpFileHandler.java
JnlpFileHandler.getUrlPrefix
private String getUrlPrefix( HttpServletRequest req ) { StringBuilder url = new StringBuilder(); String scheme = req.getScheme(); int port = req.getServerPort(); url.append( scheme ); // http, https url.append( "://" ); url.append( req.getServerName() ); ...
java
private String getUrlPrefix( HttpServletRequest req ) { StringBuilder url = new StringBuilder(); String scheme = req.getScheme(); int port = req.getServerPort(); url.append( scheme ); // http, https url.append( "://" ); url.append( req.getServerName() ); ...
[ "private", "String", "getUrlPrefix", "(", "HttpServletRequest", "req", ")", "{", "StringBuilder", "url", "=", "new", "StringBuilder", "(", ")", ";", "String", "scheme", "=", "req", ".", "getScheme", "(", ")", ";", "int", "port", "=", "req", ".", "getServer...
This code is heavily inspired by the stuff in HttpUtils.getRequestURL
[ "This", "code", "is", "heavily", "inspired", "by", "the", "stuff", "in", "HttpUtils", ".", "getRequestURL" ]
38fdd1d21f063f21716cfcd61ebeabd963487576
https://github.com/mojohaus/webstart/blob/38fdd1d21f063f21716cfcd61ebeabd963487576/webstart-jnlp-servlet/src/main/java/jnlp/sample/servlet/JnlpFileHandler.java#L362-L376
3,678
mojohaus/webstart
webstart-jnlp-servlet/src/main/java/jnlp/sample/servlet/JnlpDownloadServlet.java
JnlpDownloadServlet.validateRequest
private void validateRequest( DownloadRequest dreq ) throws ErrorResponseException { String path = dreq.getPath(); if ( path.endsWith( ResourceCatalog.VERSION_XML_FILENAME ) || path.indexOf( "__" ) != -1 ) { throw new ErrorResponseException( DownloadResponse.getNoCont...
java
private void validateRequest( DownloadRequest dreq ) throws ErrorResponseException { String path = dreq.getPath(); if ( path.endsWith( ResourceCatalog.VERSION_XML_FILENAME ) || path.indexOf( "__" ) != -1 ) { throw new ErrorResponseException( DownloadResponse.getNoCont...
[ "private", "void", "validateRequest", "(", "DownloadRequest", "dreq", ")", "throws", "ErrorResponseException", "{", "String", "path", "=", "dreq", ".", "getPath", "(", ")", ";", "if", "(", "path", ".", "endsWith", "(", "ResourceCatalog", ".", "VERSION_XML_FILENA...
Make sure that it is a valid request. This is also the place to implement the reverse IP lookup
[ "Make", "sure", "that", "it", "is", "a", "valid", "request", ".", "This", "is", "also", "the", "place", "to", "implement", "the", "reverse", "IP", "lookup" ]
38fdd1d21f063f21716cfcd61ebeabd963487576
https://github.com/mojohaus/webstart/blob/38fdd1d21f063f21716cfcd61ebeabd963487576/webstart-jnlp-servlet/src/main/java/jnlp/sample/servlet/JnlpDownloadServlet.java#L247-L255
3,679
mojohaus/webstart
webstart-jnlp-servlet/src/main/java/jnlp/sample/servlet/JnlpDownloadServlet.java
JnlpDownloadServlet.locateResource
private JnlpResource locateResource( DownloadRequest dreq ) throws IOException, ErrorResponseException { if ( dreq.getVersion() == null ) { return handleBasicDownload( dreq ); } else { return handleVersionRequest( dreq ); } }
java
private JnlpResource locateResource( DownloadRequest dreq ) throws IOException, ErrorResponseException { if ( dreq.getVersion() == null ) { return handleBasicDownload( dreq ); } else { return handleVersionRequest( dreq ); } }
[ "private", "JnlpResource", "locateResource", "(", "DownloadRequest", "dreq", ")", "throws", "IOException", ",", "ErrorResponseException", "{", "if", "(", "dreq", ".", "getVersion", "(", ")", "==", "null", ")", "{", "return", "handleBasicDownload", "(", "dreq", "...
Interprets the download request and convert it into a resource that is part of the Web Archive.
[ "Interprets", "the", "download", "request", "and", "convert", "it", "into", "a", "resource", "that", "is", "part", "of", "the", "Web", "Archive", "." ]
38fdd1d21f063f21716cfcd61ebeabd963487576
https://github.com/mojohaus/webstart/blob/38fdd1d21f063f21716cfcd61ebeabd963487576/webstart-jnlp-servlet/src/main/java/jnlp/sample/servlet/JnlpDownloadServlet.java#L261-L272
3,680
mojohaus/webstart
webstart-jnlp-servlet/src/main/java/jnlp/sample/servlet/JnlpDownloadServlet.java
JnlpDownloadServlet.constructResponse
private DownloadResponse constructResponse( JnlpResource jnlpres, DownloadRequest dreq ) throws IOException { String path = jnlpres.getPath(); if ( jnlpres.isJnlpFile() ) { // It is a JNLP file. It need to be macro-expanded, so it is handled differently bo...
java
private DownloadResponse constructResponse( JnlpResource jnlpres, DownloadRequest dreq ) throws IOException { String path = jnlpres.getPath(); if ( jnlpres.isJnlpFile() ) { // It is a JNLP file. It need to be macro-expanded, so it is handled differently bo...
[ "private", "DownloadResponse", "constructResponse", "(", "JnlpResource", "jnlpres", ",", "DownloadRequest", "dreq", ")", "throws", "IOException", "{", "String", "path", "=", "jnlpres", ".", "getPath", "(", ")", ";", "if", "(", "jnlpres", ".", "isJnlpFile", "(", ...
Given a DownloadPath and a DownloadRequest, it constructs the data stream to return to the requester
[ "Given", "a", "DownloadPath", "and", "a", "DownloadRequest", "it", "constructs", "the", "data", "stream", "to", "return", "to", "the", "requester" ]
38fdd1d21f063f21716cfcd61ebeabd963487576
https://github.com/mojohaus/webstart/blob/38fdd1d21f063f21716cfcd61ebeabd963487576/webstart-jnlp-servlet/src/main/java/jnlp/sample/servlet/JnlpDownloadServlet.java#L303-L346
3,681
mojohaus/webstart
webstart-jnlp-servlet/src/main/java/jnlp/sample/util/VersionID.java
VersionID.matchTuple
private boolean matchTuple( Object o ) { // Check for null and type if ( o == null || !( o instanceof VersionID ) ) { return false; } VersionID vid = (VersionID) o; // Normalize arrays String[] t1 = normalize( _tuple, vid._tuple.length ); ...
java
private boolean matchTuple( Object o ) { // Check for null and type if ( o == null || !( o instanceof VersionID ) ) { return false; } VersionID vid = (VersionID) o; // Normalize arrays String[] t1 = normalize( _tuple, vid._tuple.length ); ...
[ "private", "boolean", "matchTuple", "(", "Object", "o", ")", "{", "// Check for null and type", "if", "(", "o", "==", "null", "||", "!", "(", "o", "instanceof", "VersionID", ")", ")", "{", "return", "false", ";", "}", "VersionID", "vid", "=", "(", "Versi...
Compares if two version IDs are equal @param o TODO @return TODO
[ "Compares", "if", "two", "version", "IDs", "are", "equal" ]
38fdd1d21f063f21716cfcd61ebeabd963487576
https://github.com/mojohaus/webstart/blob/38fdd1d21f063f21716cfcd61ebeabd963487576/webstart-jnlp-servlet/src/main/java/jnlp/sample/util/VersionID.java#L186-L210
3,682
mojohaus/webstart
webstart-jnlp-servlet/src/main/java/jnlp/sample/util/VersionID.java
VersionID.isGreaterThanOrEqualHelper
private boolean isGreaterThanOrEqualHelper( VersionID vid, boolean allowEqual ) { if ( _isCompound ) { if ( !_rest.isGreaterThanOrEqualHelper( vid, allowEqual ) ) { return false; } } // Normalize the two strings String[] t1...
java
private boolean isGreaterThanOrEqualHelper( VersionID vid, boolean allowEqual ) { if ( _isCompound ) { if ( !_rest.isGreaterThanOrEqualHelper( vid, allowEqual ) ) { return false; } } // Normalize the two strings String[] t1...
[ "private", "boolean", "isGreaterThanOrEqualHelper", "(", "VersionID", "vid", ",", "boolean", "allowEqual", ")", "{", "if", "(", "_isCompound", ")", "{", "if", "(", "!", "_rest", ".", "isGreaterThanOrEqualHelper", "(", "vid", ",", "allowEqual", ")", ")", "{", ...
Compares if 'this' is greater than vid @param vid TODO @param allowEqual TODO @return TODO
[ "Compares", "if", "this", "is", "greater", "than", "vid" ]
38fdd1d21f063f21716cfcd61ebeabd963487576
https://github.com/mojohaus/webstart/blob/38fdd1d21f063f21716cfcd61ebeabd963487576/webstart-jnlp-servlet/src/main/java/jnlp/sample/util/VersionID.java#L243-L283
3,683
mojohaus/webstart
webstart-jnlp-servlet/src/main/java/jnlp/sample/util/VersionID.java
VersionID.isPrefixMatch
public boolean isPrefixMatch( VersionID vid ) { if ( _isCompound ) { if ( !_rest.isPrefixMatch( vid ) ) { return false; } } // Make sure that vid is at least as long as the prefix String[] t2 = normalize( vid._tuple, _tuple...
java
public boolean isPrefixMatch( VersionID vid ) { if ( _isCompound ) { if ( !_rest.isPrefixMatch( vid ) ) { return false; } } // Make sure that vid is at least as long as the prefix String[] t2 = normalize( vid._tuple, _tuple...
[ "public", "boolean", "isPrefixMatch", "(", "VersionID", "vid", ")", "{", "if", "(", "_isCompound", ")", "{", "if", "(", "!", "_rest", ".", "isPrefixMatch", "(", "vid", ")", ")", "{", "return", "false", ";", "}", "}", "// Make sure that vid is at least as lon...
Checks if 'this' is a prefix of vid @param vid TODO @return TODO
[ "Checks", "if", "this", "is", "a", "prefix", "of", "vid" ]
38fdd1d21f063f21716cfcd61ebeabd963487576
https://github.com/mojohaus/webstart/blob/38fdd1d21f063f21716cfcd61ebeabd963487576/webstart-jnlp-servlet/src/main/java/jnlp/sample/util/VersionID.java#L291-L319
3,684
mojohaus/webstart
webstart-jnlp-servlet/src/main/java/jnlp/sample/util/VersionID.java
VersionID.normalize
private String[] normalize( String[] list, int minlength ) { if ( list.length < minlength ) { // Need to do padding String[] newlist = new String[minlength]; System.arraycopy( list, 0, newlist, 0, list.length ); Arrays.fill( newlist, list.length, newli...
java
private String[] normalize( String[] list, int minlength ) { if ( list.length < minlength ) { // Need to do padding String[] newlist = new String[minlength]; System.arraycopy( list, 0, newlist, 0, list.length ); Arrays.fill( newlist, list.length, newli...
[ "private", "String", "[", "]", "normalize", "(", "String", "[", "]", "list", ",", "int", "minlength", ")", "{", "if", "(", "list", ".", "length", "<", "minlength", ")", "{", "// Need to do padding", "String", "[", "]", "newlist", "=", "new", "String", ...
Normalize an array to a certain length @param list TODO @param minlength TODO @return TODO
[ "Normalize", "an", "array", "to", "a", "certain", "length" ]
38fdd1d21f063f21716cfcd61ebeabd963487576
https://github.com/mojohaus/webstart/blob/38fdd1d21f063f21716cfcd61ebeabd963487576/webstart-jnlp-servlet/src/main/java/jnlp/sample/util/VersionID.java#L328-L342
3,685
mojohaus/webstart
webstart-maven-plugin/src/main/java/org/codehaus/mojo/webstart/dependency/task/UpdateManifestTask.java
UpdateManifestTask.createManifest
private Manifest createManifest( File jar, Map<String, String> manifestentries ) throws MojoExecutionException { JarFile jarFile = null; try { jarFile = new JarFile( jar ); // read manifest from jar Manifest manifest = jarFile.getManifest(); ...
java
private Manifest createManifest( File jar, Map<String, String> manifestentries ) throws MojoExecutionException { JarFile jarFile = null; try { jarFile = new JarFile( jar ); // read manifest from jar Manifest manifest = jarFile.getManifest(); ...
[ "private", "Manifest", "createManifest", "(", "File", "jar", ",", "Map", "<", "String", ",", "String", ">", "manifestentries", ")", "throws", "MojoExecutionException", "{", "JarFile", "jarFile", "=", "null", ";", "try", "{", "jarFile", "=", "new", "JarFile", ...
Create the new manifest from the existing jar file and the new entries. @param jar @param manifestentries @return Manifest @throws MojoExecutionException
[ "Create", "the", "new", "manifest", "from", "the", "existing", "jar", "file", "and", "the", "new", "entries", "." ]
38fdd1d21f063f21716cfcd61ebeabd963487576
https://github.com/mojohaus/webstart/blob/38fdd1d21f063f21716cfcd61ebeabd963487576/webstart-maven-plugin/src/main/java/org/codehaus/mojo/webstart/dependency/task/UpdateManifestTask.java#L172-L206
3,686
mojohaus/webstart
webstart-jnlp-servlet/src/main/java/jnlp/sample/util/VersionString.java
VersionString.contains
public boolean contains( VersionID m ) { for ( Object _versionId : _versionIds ) { VersionID vi = (VersionID) _versionId; boolean check = vi.match( m ); if ( check ) { return true; } } return false; }
java
public boolean contains( VersionID m ) { for ( Object _versionId : _versionIds ) { VersionID vi = (VersionID) _versionId; boolean check = vi.match( m ); if ( check ) { return true; } } return false; }
[ "public", "boolean", "contains", "(", "VersionID", "m", ")", "{", "for", "(", "Object", "_versionId", ":", "_versionIds", ")", "{", "VersionID", "vi", "=", "(", "VersionID", ")", "_versionId", ";", "boolean", "check", "=", "vi", ".", "match", "(", "m", ...
Check if this VersionString object contains the VersionID m @param m TODO @return TODO
[ "Check", "if", "this", "VersionString", "object", "contains", "the", "VersionID", "m" ]
38fdd1d21f063f21716cfcd61ebeabd963487576
https://github.com/mojohaus/webstart/blob/38fdd1d21f063f21716cfcd61ebeabd963487576/webstart-jnlp-servlet/src/main/java/jnlp/sample/util/VersionString.java#L79-L91
3,687
mojohaus/webstart
webstart-jnlp-servlet/src/main/java/jnlp/sample/util/VersionString.java
VersionString.containsGreaterThan
public boolean containsGreaterThan( VersionID m ) { for ( Object _versionId : _versionIds ) { VersionID vi = (VersionID) _versionId; boolean check = vi.isGreaterThan( m ); if ( check ) { return true; } } retu...
java
public boolean containsGreaterThan( VersionID m ) { for ( Object _versionId : _versionIds ) { VersionID vi = (VersionID) _versionId; boolean check = vi.isGreaterThan( m ); if ( check ) { return true; } } retu...
[ "public", "boolean", "containsGreaterThan", "(", "VersionID", "m", ")", "{", "for", "(", "Object", "_versionId", ":", "_versionIds", ")", "{", "VersionID", "vi", "=", "(", "VersionID", ")", "_versionId", ";", "boolean", "check", "=", "vi", ".", "isGreaterTha...
Check if this VersionString object contains anything greater than m @param m TODO @return TODO
[ "Check", "if", "this", "VersionString", "object", "contains", "anything", "greater", "than", "m" ]
38fdd1d21f063f21716cfcd61ebeabd963487576
https://github.com/mojohaus/webstart/blob/38fdd1d21f063f21716cfcd61ebeabd963487576/webstart-jnlp-servlet/src/main/java/jnlp/sample/util/VersionString.java#L110-L122
3,688
mojohaus/webstart
webstart-maven-plugin/src/main/java/org/codehaus/mojo/webstart/sign/SignConfig.java
SignConfig.createSignRequest
public JarSignerRequest createSignRequest( File jarToSign, File signedJar ) throws MojoExecutionException { JarSignerSignRequest request = new JarSignerSignRequest(); request.setAlias( getAlias() ); request.setKeystore( getKeystore() ); request.setSigfile( getSigfile() );...
java
public JarSignerRequest createSignRequest( File jarToSign, File signedJar ) throws MojoExecutionException { JarSignerSignRequest request = new JarSignerSignRequest(); request.setAlias( getAlias() ); request.setKeystore( getKeystore() ); request.setSigfile( getSigfile() );...
[ "public", "JarSignerRequest", "createSignRequest", "(", "File", "jarToSign", ",", "File", "signedJar", ")", "throws", "MojoExecutionException", "{", "JarSignerSignRequest", "request", "=", "new", "JarSignerSignRequest", "(", ")", ";", "request", ".", "setAlias", "(", ...
Creates a jarsigner request to do a sign operation. @param jarToSign the location of the jar to sign @param signedJar the optional location of the signed jar to produce (if not set, will use the original location) @return the jarsigner request @throws MojoExecutionException if something wrong occurs
[ "Creates", "a", "jarsigner", "request", "to", "do", "a", "sign", "operation", "." ]
38fdd1d21f063f21716cfcd61ebeabd963487576
https://github.com/mojohaus/webstart/blob/38fdd1d21f063f21716cfcd61ebeabd963487576/webstart-maven-plugin/src/main/java/org/codehaus/mojo/webstart/sign/SignConfig.java#L318-L345
3,689
mojohaus/webstart
webstart-maven-plugin/src/main/java/org/codehaus/mojo/webstart/sign/SignConfig.java
SignConfig.createVerifyRequest
public JarSignerRequest createVerifyRequest( File jarFile, boolean certs ) { JarSignerVerifyRequest request = new JarSignerVerifyRequest(); request.setCerts( certs ); request.setWorkingDirectory( workDirectory ); request.setMaxMemory( getMaxMemory() ); request.setVerbose( isV...
java
public JarSignerRequest createVerifyRequest( File jarFile, boolean certs ) { JarSignerVerifyRequest request = new JarSignerVerifyRequest(); request.setCerts( certs ); request.setWorkingDirectory( workDirectory ); request.setMaxMemory( getMaxMemory() ); request.setVerbose( isV...
[ "public", "JarSignerRequest", "createVerifyRequest", "(", "File", "jarFile", ",", "boolean", "certs", ")", "{", "JarSignerVerifyRequest", "request", "=", "new", "JarSignerVerifyRequest", "(", ")", ";", "request", ".", "setCerts", "(", "certs", ")", ";", "request",...
Creates a jarsigner request to do a verify operation. @param jarFile the location of the jar to sign @param certs flag to show certificates details @return the jarsigner request
[ "Creates", "a", "jarsigner", "request", "to", "do", "a", "verify", "operation", "." ]
38fdd1d21f063f21716cfcd61ebeabd963487576
https://github.com/mojohaus/webstart/blob/38fdd1d21f063f21716cfcd61ebeabd963487576/webstart-maven-plugin/src/main/java/org/codehaus/mojo/webstart/sign/SignConfig.java#L354-L363
3,690
mojohaus/webstart
webstart-maven-plugin/src/main/java/org/codehaus/mojo/webstart/sign/SignConfig.java
SignConfig.createKeyGenRequest
public KeyToolGenerateKeyPairRequest createKeyGenRequest( File keystoreFile ) { KeyToolGenerateKeyPairRequest request = new KeyToolGenerateKeyPairRequest(); request.setAlias( getAlias() ); request.setDname( getDname() ); request.setKeyalg( getKeyalg() ); request.setKeypass( g...
java
public KeyToolGenerateKeyPairRequest createKeyGenRequest( File keystoreFile ) { KeyToolGenerateKeyPairRequest request = new KeyToolGenerateKeyPairRequest(); request.setAlias( getAlias() ); request.setDname( getDname() ); request.setKeyalg( getKeyalg() ); request.setKeypass( g...
[ "public", "KeyToolGenerateKeyPairRequest", "createKeyGenRequest", "(", "File", "keystoreFile", ")", "{", "KeyToolGenerateKeyPairRequest", "request", "=", "new", "KeyToolGenerateKeyPairRequest", "(", ")", ";", "request", ".", "setAlias", "(", "getAlias", "(", ")", ")", ...
Creates a keytool request to do a key store generation operation. @param keystoreFile the location of the key store file to generate @return the keytool request
[ "Creates", "a", "keytool", "request", "to", "do", "a", "key", "store", "generation", "operation", "." ]
38fdd1d21f063f21716cfcd61ebeabd963487576
https://github.com/mojohaus/webstart/blob/38fdd1d21f063f21716cfcd61ebeabd963487576/webstart-maven-plugin/src/main/java/org/codehaus/mojo/webstart/sign/SignConfig.java#L371-L387
3,691
GwtMaterialDesign/gwt-material-table
src/main/java/gwt/material/design/client/ui/table/cell/Column.java
Column.onBrowserEvent
public void onBrowserEvent(Context context, Element elem, final T object, NativeEvent event) { final int index = context.getIndex(); ValueUpdater<C> valueUpdater = (fieldUpdater == null) ? null : (ValueUpdater<C>) value -> { fieldUpdater.update(index, object, value); }; cell....
java
public void onBrowserEvent(Context context, Element elem, final T object, NativeEvent event) { final int index = context.getIndex(); ValueUpdater<C> valueUpdater = (fieldUpdater == null) ? null : (ValueUpdater<C>) value -> { fieldUpdater.update(index, object, value); }; cell....
[ "public", "void", "onBrowserEvent", "(", "Context", "context", ",", "Element", "elem", ",", "final", "T", "object", ",", "NativeEvent", "event", ")", "{", "final", "int", "index", "=", "context", ".", "getIndex", "(", ")", ";", "ValueUpdater", "<", "C", ...
Handle a browser event that took place within the column. @param context the cell context @param elem the parent Element @param object the base object to be updated @param event the native browser event
[ "Handle", "a", "browser", "event", "that", "took", "place", "within", "the", "column", "." ]
1352cafdcbff747bc1f302e709ed376df6642ef5
https://github.com/GwtMaterialDesign/gwt-material-table/blob/1352cafdcbff747bc1f302e709ed376df6642ef5/src/main/java/gwt/material/design/client/ui/table/cell/Column.java#L107-L113
3,692
GwtMaterialDesign/gwt-material-table
src/main/java/gwt/material/design/client/ui/table/cell/Column.java
Column.render
public void render(Context context, T object, SafeHtmlBuilder sb) { cell.render(context, getValue(object), sb); }
java
public void render(Context context, T object, SafeHtmlBuilder sb) { cell.render(context, getValue(object), sb); }
[ "public", "void", "render", "(", "Context", "context", ",", "T", "object", ",", "SafeHtmlBuilder", "sb", ")", "{", "cell", ".", "render", "(", "context", ",", "getValue", "(", "object", ")", ",", "sb", ")", ";", "}" ]
Render the object into the cell. @param object the object to render @param sb the buffer to render into
[ "Render", "the", "object", "into", "the", "cell", "." ]
1352cafdcbff747bc1f302e709ed376df6642ef5
https://github.com/GwtMaterialDesign/gwt-material-table/blob/1352cafdcbff747bc1f302e709ed376df6642ef5/src/main/java/gwt/material/design/client/ui/table/cell/Column.java#L137-L139
3,693
GwtMaterialDesign/gwt-material-table
src/main/java/gwt/material/design/client/ui/table/cell/Column.java
Column.setStyleProperty
public final void setStyleProperty(StyleName styleName, String value) { if(styleProps == null) { styleProps = new HashMap<>(); } styleProps.put(styleName, value); }
java
public final void setStyleProperty(StyleName styleName, String value) { if(styleProps == null) { styleProps = new HashMap<>(); } styleProps.put(styleName, value); }
[ "public", "final", "void", "setStyleProperty", "(", "StyleName", "styleName", ",", "String", "value", ")", "{", "if", "(", "styleProps", "==", "null", ")", "{", "styleProps", "=", "new", "HashMap", "<>", "(", ")", ";", "}", "styleProps", ".", "put", "(",...
Set a style property using its name as the key. Please ensure the style name and value are appropriately configured or it may result in unexpected behavior. @param styleName the style name as seen here {@link Style#STYLE_Z_INDEX} for example. @param value the string value required for the given style property.
[ "Set", "a", "style", "property", "using", "its", "name", "as", "the", "key", ".", "Please", "ensure", "the", "style", "name", "and", "value", "are", "appropriately", "configured", "or", "it", "may", "result", "in", "unexpected", "behavior", "." ]
1352cafdcbff747bc1f302e709ed376df6642ef5
https://github.com/GwtMaterialDesign/gwt-material-table/blob/1352cafdcbff747bc1f302e709ed376df6642ef5/src/main/java/gwt/material/design/client/ui/table/cell/Column.java#L277-L282
3,694
GwtMaterialDesign/gwt-material-table
src/main/java/gwt/material/design/client/ui/table/cell/Column.java
Column.getStyleProperty
public final String getStyleProperty(StyleName styleName) { return styleProps!=null ? styleProps.get(styleName) : null; }
java
public final String getStyleProperty(StyleName styleName) { return styleProps!=null ? styleProps.get(styleName) : null; }
[ "public", "final", "String", "getStyleProperty", "(", "StyleName", "styleName", ")", "{", "return", "styleProps", "!=", "null", "?", "styleProps", ".", "get", "(", "styleName", ")", ":", "null", ";", "}" ]
Get a styles property. @param styleName the styles name as represented in a {@link Style} class. @return null if the style property is not set.
[ "Get", "a", "styles", "property", "." ]
1352cafdcbff747bc1f302e709ed376df6642ef5
https://github.com/GwtMaterialDesign/gwt-material-table/blob/1352cafdcbff747bc1f302e709ed376df6642ef5/src/main/java/gwt/material/design/client/ui/table/cell/Column.java#L289-L291
3,695
GwtMaterialDesign/gwt-material-table
src/main/java/gwt/material/design/client/ui/table/cell/Column.java
Column.setWidth
public final void setWidth(String width) { this.width = width; this.dynamicWidth = width != null && width.contains("%"); }
java
public final void setWidth(String width) { this.width = width; this.dynamicWidth = width != null && width.contains("%"); }
[ "public", "final", "void", "setWidth", "(", "String", "width", ")", "{", "this", ".", "width", "=", "width", ";", "this", ".", "dynamicWidth", "=", "width", "!=", "null", "&&", "width", ".", "contains", "(", "\"%\"", ")", ";", "}" ]
Set the columns header width.
[ "Set", "the", "columns", "header", "width", "." ]
1352cafdcbff747bc1f302e709ed376df6642ef5
https://github.com/GwtMaterialDesign/gwt-material-table/blob/1352cafdcbff747bc1f302e709ed376df6642ef5/src/main/java/gwt/material/design/client/ui/table/cell/Column.java#L357-L360
3,696
GwtMaterialDesign/gwt-material-table
src/main/java/gwt/material/design/client/data/infinite/InfiniteDataView.java
InfiniteDataView.loaded
public void loaded(int startIndex, List<T> data, boolean cacheData) { loaded(startIndex, data, getTotalRows(), cacheData); }
java
public void loaded(int startIndex, List<T> data, boolean cacheData) { loaded(startIndex, data, getTotalRows(), cacheData); }
[ "public", "void", "loaded", "(", "int", "startIndex", ",", "List", "<", "T", ">", "data", ",", "boolean", "cacheData", ")", "{", "loaded", "(", "startIndex", ",", "data", ",", "getTotalRows", "(", ")", ",", "cacheData", ")", ";", "}" ]
Provide the option to load data with a cache parameter.
[ "Provide", "the", "option", "to", "load", "data", "with", "a", "cache", "parameter", "." ]
1352cafdcbff747bc1f302e709ed376df6642ef5
https://github.com/GwtMaterialDesign/gwt-material-table/blob/1352cafdcbff747bc1f302e709ed376df6642ef5/src/main/java/gwt/material/design/client/data/infinite/InfiniteDataView.java#L425-L427
3,697
GwtMaterialDesign/gwt-material-table
src/main/java/gwt/material/design/client/data/infinite/InfiniteDataView.java
InfiniteDataView.getVisibleRowCapacity
public int getVisibleRowCapacity() { int rh = getCalculatedRowHeight(); double visibleHeight = getVisibleHeight(); int rows = (int) ((visibleHeight < 1) ? 0 : Math.floor(visibleHeight / rh)); int calcHeight = rh * rows; while (calcHeight < visibleHeight) { rows++; ...
java
public int getVisibleRowCapacity() { int rh = getCalculatedRowHeight(); double visibleHeight = getVisibleHeight(); int rows = (int) ((visibleHeight < 1) ? 0 : Math.floor(visibleHeight / rh)); int calcHeight = rh * rows; while (calcHeight < visibleHeight) { rows++; ...
[ "public", "int", "getVisibleRowCapacity", "(", ")", "{", "int", "rh", "=", "getCalculatedRowHeight", "(", ")", ";", "double", "visibleHeight", "=", "getVisibleHeight", "(", ")", ";", "int", "rows", "=", "(", "int", ")", "(", "(", "visibleHeight", "<", "1",...
Returns the total number of rows that are visible given the current grid height.
[ "Returns", "the", "total", "number", "of", "rows", "that", "are", "visible", "given", "the", "current", "grid", "height", "." ]
1352cafdcbff747bc1f302e709ed376df6642ef5
https://github.com/GwtMaterialDesign/gwt-material-table/blob/1352cafdcbff747bc1f302e709ed376df6642ef5/src/main/java/gwt/material/design/client/data/infinite/InfiniteDataView.java#L467-L482
3,698
GwtMaterialDesign/gwt-material-table
src/main/java/gwt/material/design/client/ui/table/cell/FrozenProperties.java
FrozenProperties.setHeaderStyleProperty
public FrozenProperties setHeaderStyleProperty(StyleName styleName, String value) { headerStyleProps.put(styleName, value); return this; }
java
public FrozenProperties setHeaderStyleProperty(StyleName styleName, String value) { headerStyleProps.put(styleName, value); return this; }
[ "public", "FrozenProperties", "setHeaderStyleProperty", "(", "StyleName", "styleName", ",", "String", "value", ")", "{", "headerStyleProps", ".", "put", "(", "styleName", ",", "value", ")", ";", "return", "this", ";", "}" ]
Set a header style property using its name as the key. Please ensure the style name and value are appropriately configured or it may result in unexpected behavior. @param styleName the style name as seen here {@link Style#STYLE_Z_INDEX} for example. @param value the string value required for the given style property.
[ "Set", "a", "header", "style", "property", "using", "its", "name", "as", "the", "key", ".", "Please", "ensure", "the", "style", "name", "and", "value", "are", "appropriately", "configured", "or", "it", "may", "result", "in", "unexpected", "behavior", "." ]
1352cafdcbff747bc1f302e709ed376df6642ef5
https://github.com/GwtMaterialDesign/gwt-material-table/blob/1352cafdcbff747bc1f302e709ed376df6642ef5/src/main/java/gwt/material/design/client/ui/table/cell/FrozenProperties.java#L104-L107
3,699
GwtMaterialDesign/gwt-material-table
src/main/java/gwt/material/design/client/ui/table/CellBasedWidgetImpl.java
CellBasedWidgetImpl.isFocusable
public boolean isFocusable(Element elem) { return focusableTypes.contains(elem.getTagName().toLowerCase(Locale.ROOT)) || elem.getTabIndex() >= 0; }
java
public boolean isFocusable(Element elem) { return focusableTypes.contains(elem.getTagName().toLowerCase(Locale.ROOT)) || elem.getTabIndex() >= 0; }
[ "public", "boolean", "isFocusable", "(", "Element", "elem", ")", "{", "return", "focusableTypes", ".", "contains", "(", "elem", ".", "getTagName", "(", ")", ".", "toLowerCase", "(", "Locale", ".", "ROOT", ")", ")", "||", "elem", ".", "getTabIndex", "(", ...
Check if an element is focusable. If an element is focusable, the cell widget should not steal focus from it. @param elem the element @return true if the element is focusable, false if not
[ "Check", "if", "an", "element", "is", "focusable", ".", "If", "an", "element", "is", "focusable", "the", "cell", "widget", "should", "not", "steal", "focus", "from", "it", "." ]
1352cafdcbff747bc1f302e709ed376df6642ef5
https://github.com/GwtMaterialDesign/gwt-material-table/blob/1352cafdcbff747bc1f302e709ed376df6642ef5/src/main/java/gwt/material/design/client/ui/table/CellBasedWidgetImpl.java#L94-L97