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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
62,400 | VoltDB/voltdb | third_party/java/src/org/apache/zookeeper_voltpatches/ZooKeeper.java | ZooKeeper.setACL | public void setACL(final String path, List<ACL> acl, int version,
StatCallback cb, Object ctx) {
verbotenThreadCheck();
final String clientPath = path;
PathUtils.validatePath(clientPath);
final String serverPath = prependChroot(clientPath);
RequestHeader h = new Req... | java | public void setACL(final String path, List<ACL> acl, int version,
StatCallback cb, Object ctx) {
verbotenThreadCheck();
final String clientPath = path;
PathUtils.validatePath(clientPath);
final String serverPath = prependChroot(clientPath);
RequestHeader h = new Req... | [
"public",
"void",
"setACL",
"(",
"final",
"String",
"path",
",",
"List",
"<",
"ACL",
">",
"acl",
",",
"int",
"version",
",",
"StatCallback",
"cb",
",",
"Object",
"ctx",
")",
"{",
"verbotenThreadCheck",
"(",
")",
";",
"final",
"String",
"clientPath",
"=",... | The Asynchronous version of setACL. The request doesn't actually until
the asynchronous callback is called.
@see #setACL(String, List, int) | [
"The",
"Asynchronous",
"version",
"of",
"setACL",
".",
"The",
"request",
"doesn",
"t",
"actually",
"until",
"the",
"asynchronous",
"callback",
"is",
"called",
"."
] | 8afc1031e475835344b5497ea9e7203bc95475ac | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/third_party/java/src/org/apache/zookeeper_voltpatches/ZooKeeper.java#L1240-L1257 |
62,401 | VoltDB/voltdb | third_party/java/src/org/apache/zookeeper_voltpatches/ZooKeeper.java | ZooKeeper.sync | public void sync(final String path, VoidCallback cb, Object ctx) {
verbotenThreadCheck();
final String clientPath = path;
PathUtils.validatePath(clientPath);
final String serverPath = prependChroot(clientPath);
RequestHeader h = new RequestHeader();
h.setType(ZooDefs.Op... | java | public void sync(final String path, VoidCallback cb, Object ctx) {
verbotenThreadCheck();
final String clientPath = path;
PathUtils.validatePath(clientPath);
final String serverPath = prependChroot(clientPath);
RequestHeader h = new RequestHeader();
h.setType(ZooDefs.Op... | [
"public",
"void",
"sync",
"(",
"final",
"String",
"path",
",",
"VoidCallback",
"cb",
",",
"Object",
"ctx",
")",
"{",
"verbotenThreadCheck",
"(",
")",
";",
"final",
"String",
"clientPath",
"=",
"path",
";",
"PathUtils",
".",
"validatePath",
"(",
"clientPath",... | Asynchronous sync. Flushes channel between process and leader.
@param path
@param cb
a handler for the callback
@param ctx
context to be provided to the callback
@throws IllegalArgumentException
if an invalid path is specified | [
"Asynchronous",
"sync",
".",
"Flushes",
"channel",
"between",
"process",
"and",
"leader",
"."
] | 8afc1031e475835344b5497ea9e7203bc95475ac | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/third_party/java/src/org/apache/zookeeper_voltpatches/ZooKeeper.java#L1529-L1543 |
62,402 | VoltDB/voltdb | src/frontend/org/voltdb/client/ClientImpl.java | ClientImpl.callProcedureWithTimeout | @Override
public final boolean callProcedureWithTimeout(
ProcedureCallback callback,
int batchTimeout,
String procName,
Object... parameters)
throws IOException, NoConnectionsException
{
//Time unit doesn't matter in this case since the... | java | @Override
public final boolean callProcedureWithTimeout(
ProcedureCallback callback,
int batchTimeout,
String procName,
Object... parameters)
throws IOException, NoConnectionsException
{
//Time unit doesn't matter in this case since the... | [
"@",
"Override",
"public",
"final",
"boolean",
"callProcedureWithTimeout",
"(",
"ProcedureCallback",
"callback",
",",
"int",
"batchTimeout",
",",
"String",
"procName",
",",
"Object",
"...",
"parameters",
")",
"throws",
"IOException",
",",
"NoConnectionsException",
"{"... | Asynchronously invoke a procedure call with timeout.
@param callback TransactionCallback that will be invoked with procedure results.
@param batchTimeout procedure invocation batch timeout.
@param procName class name (not qualified by package) of the procedure to execute.
@param parameters vararg list of procedure's pa... | [
"Asynchronously",
"invoke",
"a",
"procedure",
"call",
"with",
"timeout",
"."
] | 8afc1031e475835344b5497ea9e7203bc95475ac | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/client/ClientImpl.java#L354-L371 |
62,403 | VoltDB/voltdb | src/frontend/org/voltdb/client/ClientImpl.java | ClientImpl.getUpdateCatalogParams | private Object[] getUpdateCatalogParams(File catalogPath, File deploymentPath)
throws IOException {
Object[] params = new Object[2];
if (catalogPath != null) {
params[0] = ClientUtils.fileToBytes(catalogPath);
}
else {
params[0] = null;
}
if (d... | java | private Object[] getUpdateCatalogParams(File catalogPath, File deploymentPath)
throws IOException {
Object[] params = new Object[2];
if (catalogPath != null) {
params[0] = ClientUtils.fileToBytes(catalogPath);
}
else {
params[0] = null;
}
if (d... | [
"private",
"Object",
"[",
"]",
"getUpdateCatalogParams",
"(",
"File",
"catalogPath",
",",
"File",
"deploymentPath",
")",
"throws",
"IOException",
"{",
"Object",
"[",
"]",
"params",
"=",
"new",
"Object",
"[",
"2",
"]",
";",
"if",
"(",
"catalogPath",
"!=",
"... | Serializes catalog and deployment file for UpdateApplicationCatalog.
Catalog is serialized into byte array, deployment file is serialized into
string.
@param catalogPath
@param deploymentPath
@return Parameters that can be passed to UpdateApplicationCatalog
@throws IOException If either of the files cannot be read | [
"Serializes",
"catalog",
"and",
"deployment",
"file",
"for",
"UpdateApplicationCatalog",
".",
"Catalog",
"is",
"serialized",
"into",
"byte",
"array",
"deployment",
"file",
"is",
"serialized",
"into",
"string",
"."
] | 8afc1031e475835344b5497ea9e7203bc95475ac | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/client/ClientImpl.java#L547-L563 |
62,404 | VoltDB/voltdb | src/frontend/org/voltdb/client/ClientImpl.java | ClientImpl.close | @Override
public void close() throws InterruptedException {
if (m_blessedThreadIds.contains(Thread.currentThread().getId())) {
throw new RuntimeException("Can't invoke backpressureBarrier from within the client callback thread " +
" without deadlocking the client library");
... | java | @Override
public void close() throws InterruptedException {
if (m_blessedThreadIds.contains(Thread.currentThread().getId())) {
throw new RuntimeException("Can't invoke backpressureBarrier from within the client callback thread " +
" without deadlocking the client library");
... | [
"@",
"Override",
"public",
"void",
"close",
"(",
")",
"throws",
"InterruptedException",
"{",
"if",
"(",
"m_blessedThreadIds",
".",
"contains",
"(",
"Thread",
".",
"currentThread",
"(",
")",
".",
"getId",
"(",
")",
")",
")",
"{",
"throw",
"new",
"RuntimeExc... | Shutdown the client closing all network connections and release
all memory resources.
@throws InterruptedException | [
"Shutdown",
"the",
"client",
"closing",
"all",
"network",
"connections",
"and",
"release",
"all",
"memory",
"resources",
"."
] | 8afc1031e475835344b5497ea9e7203bc95475ac | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/client/ClientImpl.java#L622-L648 |
62,405 | VoltDB/voltdb | src/frontend/org/voltdb/client/ClientImpl.java | ClientImpl.backpressureBarrier | public boolean backpressureBarrier(final long start, long timeoutNanos) throws InterruptedException {
if (m_isShutdown) {
return false;
}
if (m_blessedThreadIds.contains(Thread.currentThread().getId())) {
throw new RuntimeException("Can't invoke backpressureBarrier from w... | java | public boolean backpressureBarrier(final long start, long timeoutNanos) throws InterruptedException {
if (m_isShutdown) {
return false;
}
if (m_blessedThreadIds.contains(Thread.currentThread().getId())) {
throw new RuntimeException("Can't invoke backpressureBarrier from w... | [
"public",
"boolean",
"backpressureBarrier",
"(",
"final",
"long",
"start",
",",
"long",
"timeoutNanos",
")",
"throws",
"InterruptedException",
"{",
"if",
"(",
"m_isShutdown",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"m_blessedThreadIds",
".",
"contains"... | Wait on backpressure with a timeout. Returns true on timeout, false otherwise.
Timeout nanos is the initial timeout quantity which will be adjusted to reflect remaining
time on spurious wakeups | [
"Wait",
"on",
"backpressure",
"with",
"a",
"timeout",
".",
"Returns",
"true",
"on",
"timeout",
"false",
"otherwise",
".",
"Timeout",
"nanos",
"is",
"the",
"initial",
"timeout",
"quantity",
"which",
"will",
"be",
"adjusted",
"to",
"reflect",
"remaining",
"time"... | 8afc1031e475835344b5497ea9e7203bc95475ac | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/client/ClientImpl.java#L660-L703 |
62,406 | VoltDB/voltdb | src/hsqldb19b3/org/hsqldb_voltpatches/rowio/RowInputBase.java | RowInputBase.readData | public Object[] readData(Type[] colTypes)
throws IOException, HsqlException {
int l = colTypes.length;
Object[] data = new Object[l];
Object o;
Type type;
for (int i = 0; i < l; i++) {
if (checkNull()) {
continue;
}
... | java | public Object[] readData(Type[] colTypes)
throws IOException, HsqlException {
int l = colTypes.length;
Object[] data = new Object[l];
Object o;
Type type;
for (int i = 0; i < l; i++) {
if (checkNull()) {
continue;
}
... | [
"public",
"Object",
"[",
"]",
"readData",
"(",
"Type",
"[",
"]",
"colTypes",
")",
"throws",
"IOException",
",",
"HsqlException",
"{",
"int",
"l",
"=",
"colTypes",
".",
"length",
";",
"Object",
"[",
"]",
"data",
"=",
"new",
"Object",
"[",
"l",
"]",
";... | reads row data from a stream using the JDBC types in colTypes
@param colTypes
@throws IOException
@throws HsqlException | [
"reads",
"row",
"data",
"from",
"a",
"stream",
"using",
"the",
"JDBC",
"types",
"in",
"colTypes"
] | 8afc1031e475835344b5497ea9e7203bc95475ac | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/rowio/RowInputBase.java#L150-L270 |
62,407 | mpatric/mp3agic | src/main/java/com/mpatric/mp3agic/ID3v1Genres.java | ID3v1Genres.matchGenreDescription | public static int matchGenreDescription(String description) {
if (description != null && description.length() > 0) {
for (int i = 0; i < ID3v1Genres.GENRES.length; i++) {
if (ID3v1Genres.GENRES[i].equalsIgnoreCase(description)) {
return i;
}
}
}
return -1;
} | java | public static int matchGenreDescription(String description) {
if (description != null && description.length() > 0) {
for (int i = 0; i < ID3v1Genres.GENRES.length; i++) {
if (ID3v1Genres.GENRES[i].equalsIgnoreCase(description)) {
return i;
}
}
}
return -1;
} | [
"public",
"static",
"int",
"matchGenreDescription",
"(",
"String",
"description",
")",
"{",
"if",
"(",
"description",
"!=",
"null",
"&&",
"description",
".",
"length",
"(",
")",
">",
"0",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"ID... | Match provided description against genres, ignoring case.
@param description genre description
@return matching genre index or -1 | [
"Match",
"provided",
"description",
"against",
"genres",
"ignoring",
"case",
"."
] | c3917e8438124142e65e7d816142bff845ac93aa | https://github.com/mpatric/mp3agic/blob/c3917e8438124142e65e7d816142bff845ac93aa/src/main/java/com/mpatric/mp3agic/ID3v1Genres.java#L163-L172 |
62,408 | iwgang/CountdownView | library/src/main/java/cn/iwgang/countdownview/CountdownView.java | CountdownView.measureSize | private int measureSize(int specType, int contentSize, int measureSpec) {
int result;
int specMode = MeasureSpec.getMode(measureSpec);
int specSize = MeasureSpec.getSize(measureSpec);
if (specMode == MeasureSpec.EXACTLY) {
result = Math.max(contentSize, specSize);
} ... | java | private int measureSize(int specType, int contentSize, int measureSpec) {
int result;
int specMode = MeasureSpec.getMode(measureSpec);
int specSize = MeasureSpec.getSize(measureSpec);
if (specMode == MeasureSpec.EXACTLY) {
result = Math.max(contentSize, specSize);
} ... | [
"private",
"int",
"measureSize",
"(",
"int",
"specType",
",",
"int",
"contentSize",
",",
"int",
"measureSpec",
")",
"{",
"int",
"result",
";",
"int",
"specMode",
"=",
"MeasureSpec",
".",
"getMode",
"(",
"measureSpec",
")",
";",
"int",
"specSize",
"=",
"Mea... | measure view Size
@param specType 1 width 2 height
@param contentSize all content view size
@param measureSpec spec
@return measureSize | [
"measure",
"view",
"Size"
] | 3433615826b6e0a38b92e3362ba032947d9e8be7 | https://github.com/iwgang/CountdownView/blob/3433615826b6e0a38b92e3362ba032947d9e8be7/library/src/main/java/cn/iwgang/countdownview/CountdownView.java#L66-L86 |
62,409 | iwgang/CountdownView | library/src/main/java/cn/iwgang/countdownview/BaseCountdown.java | BaseCountdown.initSuffixMargin | private void initSuffixMargin() {
int defSuffixLRMargin = Utils.dp2px(mContext, DEFAULT_SUFFIX_LR_MARGIN);
boolean isSuffixLRMarginNull = true;
if (mSuffixLRMargin >= 0) {
isSuffixLRMarginNull = false;
}
if (isShowDay && mSuffixDayTextWidth > 0) {
if (mS... | java | private void initSuffixMargin() {
int defSuffixLRMargin = Utils.dp2px(mContext, DEFAULT_SUFFIX_LR_MARGIN);
boolean isSuffixLRMarginNull = true;
if (mSuffixLRMargin >= 0) {
isSuffixLRMarginNull = false;
}
if (isShowDay && mSuffixDayTextWidth > 0) {
if (mS... | [
"private",
"void",
"initSuffixMargin",
"(",
")",
"{",
"int",
"defSuffixLRMargin",
"=",
"Utils",
".",
"dp2px",
"(",
"mContext",
",",
"DEFAULT_SUFFIX_LR_MARGIN",
")",
";",
"boolean",
"isSuffixLRMarginNull",
"=",
"true",
";",
"if",
"(",
"mSuffixLRMargin",
">=",
"0"... | initialize suffix margin | [
"initialize",
"suffix",
"margin"
] | 3433615826b6e0a38b92e3362ba032947d9e8be7 | https://github.com/iwgang/CountdownView/blob/3433615826b6e0a38b92e3362ba032947d9e8be7/library/src/main/java/cn/iwgang/countdownview/BaseCountdown.java#L269-L386 |
62,410 | iwgang/CountdownView | library/src/main/java/cn/iwgang/countdownview/BaseCountdown.java | BaseCountdown.getAllContentWidth | public int getAllContentWidth() {
float width = getAllContentWidthBase(mTimeTextWidth);
if (!isConvertDaysToHours && isShowDay) {
if (isDayLargeNinetyNine) {
Rect rect = new Rect();
String tempDay = String.valueOf(mDay);
mTimeTextPaint.getText... | java | public int getAllContentWidth() {
float width = getAllContentWidthBase(mTimeTextWidth);
if (!isConvertDaysToHours && isShowDay) {
if (isDayLargeNinetyNine) {
Rect rect = new Rect();
String tempDay = String.valueOf(mDay);
mTimeTextPaint.getText... | [
"public",
"int",
"getAllContentWidth",
"(",
")",
"{",
"float",
"width",
"=",
"getAllContentWidthBase",
"(",
"mTimeTextWidth",
")",
";",
"if",
"(",
"!",
"isConvertDaysToHours",
"&&",
"isShowDay",
")",
"{",
"if",
"(",
"isDayLargeNinetyNine",
")",
"{",
"Rect",
"r... | get all view width
@return all view width | [
"get",
"all",
"view",
"width"
] | 3433615826b6e0a38b92e3362ba032947d9e8be7 | https://github.com/iwgang/CountdownView/blob/3433615826b6e0a38b92e3362ba032947d9e8be7/library/src/main/java/cn/iwgang/countdownview/BaseCountdown.java#L504-L521 |
62,411 | iwgang/CountdownView | library/src/main/java/cn/iwgang/countdownview/BackgroundCountdown.java | BackgroundCountdown.initTimeTextBaselineAndTimeBgTopPadding | private float initTimeTextBaselineAndTimeBgTopPadding(int viewHeight, int viewPaddingTop, int viewPaddingBottom, int contentAllHeight) {
float topPaddingSize;
if (viewPaddingTop == viewPaddingBottom) {
// center
topPaddingSize = (viewHeight - contentAllHeight) / 2;
} else... | java | private float initTimeTextBaselineAndTimeBgTopPadding(int viewHeight, int viewPaddingTop, int viewPaddingBottom, int contentAllHeight) {
float topPaddingSize;
if (viewPaddingTop == viewPaddingBottom) {
// center
topPaddingSize = (viewHeight - contentAllHeight) / 2;
} else... | [
"private",
"float",
"initTimeTextBaselineAndTimeBgTopPadding",
"(",
"int",
"viewHeight",
",",
"int",
"viewPaddingTop",
",",
"int",
"viewPaddingBottom",
",",
"int",
"contentAllHeight",
")",
"{",
"float",
"topPaddingSize",
";",
"if",
"(",
"viewPaddingTop",
"==",
"viewPa... | initialize time text baseline
and
time background top padding | [
"initialize",
"time",
"text",
"baseline",
"and",
"time",
"background",
"top",
"padding"
] | 3433615826b6e0a38b92e3362ba032947d9e8be7 | https://github.com/iwgang/CountdownView/blob/3433615826b6e0a38b92e3362ba032947d9e8be7/library/src/main/java/cn/iwgang/countdownview/BackgroundCountdown.java#L240-L271 |
62,412 | haraldk/TwelveMonkeys | common/common-image/src/main/java/com/twelvemonkeys/image/BrightnessContrastFilter.java | BrightnessContrastFilter.filterRGB | public int filterRGB(int pX, int pY, int pARGB) {
// Get color components
int r = pARGB >> 16 & 0xFF;
int g = pARGB >> 8 & 0xFF;
int b = pARGB & 0xFF;
// Scale to new contrast
r = LUT[r];
g = LUT[g];
b = LUT[b];
// Return ARGB pixel, l... | java | public int filterRGB(int pX, int pY, int pARGB) {
// Get color components
int r = pARGB >> 16 & 0xFF;
int g = pARGB >> 8 & 0xFF;
int b = pARGB & 0xFF;
// Scale to new contrast
r = LUT[r];
g = LUT[g];
b = LUT[b];
// Return ARGB pixel, l... | [
"public",
"int",
"filterRGB",
"(",
"int",
"pX",
",",
"int",
"pY",
",",
"int",
"pARGB",
")",
"{",
"// Get color components\r",
"int",
"r",
"=",
"pARGB",
">>",
"16",
"&",
"0xFF",
";",
"int",
"g",
"=",
"pARGB",
">>",
"8",
"&",
"0xFF",
";",
"int",
"b",... | Filters one pixel, adjusting brightness and contrast according to this
filter.
@param pX x
@param pY y
@param pARGB pixel value in default color space
@return the filtered pixel value in the default color space | [
"Filters",
"one",
"pixel",
"adjusting",
"brightness",
"and",
"contrast",
"according",
"to",
"this",
"filter",
"."
] | 7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d | https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/common/common-image/src/main/java/com/twelvemonkeys/image/BrightnessContrastFilter.java#L156-L169 |
62,413 | haraldk/TwelveMonkeys | sandbox/sandbox-common/src/main/java/com/twelvemonkeys/util/DebugUtil.java | DebugUtil.buildTimestamp | protected static String buildTimestamp(final Calendar pCalendar) {
if (pCalendar == null) {
return CALENDAR_IS_NULL_ERROR_MESSAGE;
}
// The timestamp format
StringBuilder timestamp = new StringBuilder();
//timestamp.append(DateUtil.getMonthName(new Integer(pCalendar.get(Calendar.MO... | java | protected static String buildTimestamp(final Calendar pCalendar) {
if (pCalendar == null) {
return CALENDAR_IS_NULL_ERROR_MESSAGE;
}
// The timestamp format
StringBuilder timestamp = new StringBuilder();
//timestamp.append(DateUtil.getMonthName(new Integer(pCalendar.get(Calendar.MO... | [
"protected",
"static",
"String",
"buildTimestamp",
"(",
"final",
"Calendar",
"pCalendar",
")",
"{",
"if",
"(",
"pCalendar",
"==",
"null",
")",
"{",
"return",
"CALENDAR_IS_NULL_ERROR_MESSAGE",
";",
"}",
"// The timestamp format\r",
"StringBuilder",
"timestamp",
"=",
... | Builds a presentation of the given calendar's time. This method contains the common timestamp format used in this class.
@return a presentation of the calendar time. | [
"Builds",
"a",
"presentation",
"of",
"the",
"given",
"calendar",
"s",
"time",
".",
"This",
"method",
"contains",
"the",
"common",
"timestamp",
"format",
"used",
"in",
"this",
"class",
"."
] | 7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d | https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/sandbox/sandbox-common/src/main/java/com/twelvemonkeys/util/DebugUtil.java#L818-L837 |
62,414 | haraldk/TwelveMonkeys | common/common-lang/src/main/java/com/twelvemonkeys/lang/DateUtil.java | DateUtil.roundToHour | public static long roundToHour(final long pTime, final TimeZone pTimeZone) {
int offset = pTimeZone.getOffset(pTime);
return ((pTime / HOUR) * HOUR) - offset;
} | java | public static long roundToHour(final long pTime, final TimeZone pTimeZone) {
int offset = pTimeZone.getOffset(pTime);
return ((pTime / HOUR) * HOUR) - offset;
} | [
"public",
"static",
"long",
"roundToHour",
"(",
"final",
"long",
"pTime",
",",
"final",
"TimeZone",
"pTimeZone",
")",
"{",
"int",
"offset",
"=",
"pTimeZone",
".",
"getOffset",
"(",
"pTime",
")",
";",
"return",
"(",
"(",
"pTime",
"/",
"HOUR",
")",
"*",
... | Rounds the given time down to the closest hour, using the given timezone.
@param pTime time
@param pTimeZone the timezone to use when rounding
@return the time rounded to the closest hour. | [
"Rounds",
"the",
"given",
"time",
"down",
"to",
"the",
"closest",
"hour",
"using",
"the",
"given",
"timezone",
"."
] | 7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d | https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/common/common-lang/src/main/java/com/twelvemonkeys/lang/DateUtil.java#L178-L181 |
62,415 | haraldk/TwelveMonkeys | common/common-lang/src/main/java/com/twelvemonkeys/lang/DateUtil.java | DateUtil.roundToDay | public static long roundToDay(final long pTime, final TimeZone pTimeZone) {
int offset = pTimeZone.getOffset(pTime);
return (((pTime + offset) / DAY) * DAY) - offset;
} | java | public static long roundToDay(final long pTime, final TimeZone pTimeZone) {
int offset = pTimeZone.getOffset(pTime);
return (((pTime + offset) / DAY) * DAY) - offset;
} | [
"public",
"static",
"long",
"roundToDay",
"(",
"final",
"long",
"pTime",
",",
"final",
"TimeZone",
"pTimeZone",
")",
"{",
"int",
"offset",
"=",
"pTimeZone",
".",
"getOffset",
"(",
"pTime",
")",
";",
"return",
"(",
"(",
"(",
"pTime",
"+",
"offset",
")",
... | Rounds the given time down to the closest day, using the given timezone.
@param pTime time
@param pTimeZone the timezone to use when rounding
@return the time rounded to the closest day. | [
"Rounds",
"the",
"given",
"time",
"down",
"to",
"the",
"closest",
"day",
"using",
"the",
"given",
"timezone",
"."
] | 7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d | https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/common/common-lang/src/main/java/com/twelvemonkeys/lang/DateUtil.java#L200-L203 |
62,416 | haraldk/TwelveMonkeys | common/common-lang/src/main/java/com/twelvemonkeys/util/convert/ConverterImpl.java | ConverterImpl.getConverterForType | private PropertyConverter getConverterForType(Class pType) {
Object converter;
Class cl = pType;
// Loop until we find a suitable converter
do {
// Have a match, return converter
if ((converter = getInstance().converters.get(cl)) != null) {
... | java | private PropertyConverter getConverterForType(Class pType) {
Object converter;
Class cl = pType;
// Loop until we find a suitable converter
do {
// Have a match, return converter
if ((converter = getInstance().converters.get(cl)) != null) {
... | [
"private",
"PropertyConverter",
"getConverterForType",
"(",
"Class",
"pType",
")",
"{",
"Object",
"converter",
";",
"Class",
"cl",
"=",
"pType",
";",
"// Loop until we find a suitable converter\r",
"do",
"{",
"// Have a match, return converter\r",
"if",
"(",
"(",
"conve... | Gets the registered converter for the given type.
@param pType the type to convert to
@return an instance of a {@code PropertyConverter} or {@code null} | [
"Gets",
"the",
"registered",
"converter",
"for",
"the",
"given",
"type",
"."
] | 7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d | https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/common/common-lang/src/main/java/com/twelvemonkeys/util/convert/ConverterImpl.java#L57-L73 |
62,417 | haraldk/TwelveMonkeys | common/common-lang/src/main/java/com/twelvemonkeys/util/convert/ConverterImpl.java | ConverterImpl.toObject | public Object toObject(String pString, Class pType, String pFormat)
throws ConversionException {
if (pString == null) {
return null;
}
if (pType == null) {
throw new MissingTypeException();
}
// Get converter
PropertyConver... | java | public Object toObject(String pString, Class pType, String pFormat)
throws ConversionException {
if (pString == null) {
return null;
}
if (pType == null) {
throw new MissingTypeException();
}
// Get converter
PropertyConver... | [
"public",
"Object",
"toObject",
"(",
"String",
"pString",
",",
"Class",
"pType",
",",
"String",
"pFormat",
")",
"throws",
"ConversionException",
"{",
"if",
"(",
"pString",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"pType",
"==",
"nul... | Converts the string to an object of the given type, parsing after the
given format.
@param pString the string to convert
@param pType the type to convert to
@param pFormat the vonversion format
@return the object created from the given string.
@throws ConversionException if the string cannot be converted for any
rea... | [
"Converts",
"the",
"string",
"to",
"an",
"object",
"of",
"the",
"given",
"type",
"parsing",
"after",
"the",
"given",
"format",
"."
] | 7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d | https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/common/common-lang/src/main/java/com/twelvemonkeys/util/convert/ConverterImpl.java#L88-L108 |
62,418 | haraldk/TwelveMonkeys | contrib/src/main/java/com/twelvemonkeys/contrib/tiff/TIFFUtilities.java | TIFFUtilities.merge | public static void merge(List<File> inputFiles, File outputFile) throws IOException {
ImageOutputStream output = null;
try {
output = ImageIO.createImageOutputStream(outputFile);
for (File file : inputFiles) {
ImageInputStream input = null;
try {
... | java | public static void merge(List<File> inputFiles, File outputFile) throws IOException {
ImageOutputStream output = null;
try {
output = ImageIO.createImageOutputStream(outputFile);
for (File file : inputFiles) {
ImageInputStream input = null;
try {
... | [
"public",
"static",
"void",
"merge",
"(",
"List",
"<",
"File",
">",
"inputFiles",
",",
"File",
"outputFile",
")",
"throws",
"IOException",
"{",
"ImageOutputStream",
"output",
"=",
"null",
";",
"try",
"{",
"output",
"=",
"ImageIO",
".",
"createImageOutputStream... | Merges all pages from the input TIFF files into one TIFF file at the
output location.
@param inputFiles
@param outputFile
@throws IOException | [
"Merges",
"all",
"pages",
"from",
"the",
"input",
"TIFF",
"files",
"into",
"one",
"TIFF",
"file",
"at",
"the",
"output",
"location",
"."
] | 7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d | https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/contrib/src/main/java/com/twelvemonkeys/contrib/tiff/TIFFUtilities.java#L73-L98 |
62,419 | haraldk/TwelveMonkeys | contrib/src/main/java/com/twelvemonkeys/contrib/tiff/TIFFUtilities.java | TIFFUtilities.split | public static List<File> split(File inputFile, File outputDirectory) throws IOException {
ImageInputStream input = null;
List<File> outputFiles = new ArrayList<>();
try {
input = ImageIO.createImageInputStream(inputFile);
List<TIFFPage> pages = getPages(input);
... | java | public static List<File> split(File inputFile, File outputDirectory) throws IOException {
ImageInputStream input = null;
List<File> outputFiles = new ArrayList<>();
try {
input = ImageIO.createImageInputStream(inputFile);
List<TIFFPage> pages = getPages(input);
... | [
"public",
"static",
"List",
"<",
"File",
">",
"split",
"(",
"File",
"inputFile",
",",
"File",
"outputDirectory",
")",
"throws",
"IOException",
"{",
"ImageInputStream",
"input",
"=",
"null",
";",
"List",
"<",
"File",
">",
"outputFiles",
"=",
"new",
"ArrayList... | Splits all pages from the input TIFF file to one file per page in the
output directory.
@param inputFile
@param outputDirectory
@return generated files
@throws IOException | [
"Splits",
"all",
"pages",
"from",
"the",
"input",
"TIFF",
"file",
"to",
"one",
"file",
"per",
"page",
"in",
"the",
"output",
"directory",
"."
] | 7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d | https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/contrib/src/main/java/com/twelvemonkeys/contrib/tiff/TIFFUtilities.java#L109-L142 |
62,420 | haraldk/TwelveMonkeys | sandbox/sandbox-common/src/main/java/com/twelvemonkeys/sql/ObjectReader.java | ObjectReader.getStats | public static String getStats() {
long total = sCacheHit + sCacheMiss + sCacheUn;
double hit = ((double) sCacheHit / (double) total) * 100.0;
double miss = ((double) sCacheMiss / (double) total) * 100.0;
double un = ((double) sCacheUn / (double) total) * 100.0;
// Default ... | java | public static String getStats() {
long total = sCacheHit + sCacheMiss + sCacheUn;
double hit = ((double) sCacheHit / (double) total) * 100.0;
double miss = ((double) sCacheMiss / (double) total) * 100.0;
double un = ((double) sCacheUn / (double) total) * 100.0;
// Default ... | [
"public",
"static",
"String",
"getStats",
"(",
")",
"{",
"long",
"total",
"=",
"sCacheHit",
"+",
"sCacheMiss",
"+",
"sCacheUn",
";",
"double",
"hit",
"=",
"(",
"(",
"double",
")",
"sCacheHit",
"/",
"(",
"double",
")",
"total",
")",
"*",
"100.0",
";",
... | Gets a string containing the stats for this ObjectReader.
@return A string to display the stats. | [
"Gets",
"a",
"string",
"containing",
"the",
"stats",
"for",
"this",
"ObjectReader",
"."
] | 7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d | https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/sandbox/sandbox-common/src/main/java/com/twelvemonkeys/sql/ObjectReader.java#L190-L203 |
62,421 | haraldk/TwelveMonkeys | sandbox/sandbox-common/src/main/java/com/twelvemonkeys/sql/ObjectReader.java | ObjectReader.readIdentities | private Object[] readIdentities(Class pObjClass, Hashtable pMapping,
Hashtable pWhere, ObjectMapper pOM)
throws SQLException {
sCacheUn++;
// Build SQL query string
if (pWhere == null)
pWhere = new Hashtable();
String[] ... | java | private Object[] readIdentities(Class pObjClass, Hashtable pMapping,
Hashtable pWhere, ObjectMapper pOM)
throws SQLException {
sCacheUn++;
// Build SQL query string
if (pWhere == null)
pWhere = new Hashtable();
String[] ... | [
"private",
"Object",
"[",
"]",
"readIdentities",
"(",
"Class",
"pObjClass",
",",
"Hashtable",
"pMapping",
",",
"Hashtable",
"pWhere",
",",
"ObjectMapper",
"pOM",
")",
"throws",
"SQLException",
"{",
"sCacheUn",
"++",
";",
"// Build SQL query string\r",
"if",
"(",
... | Get an array containing Objects of type objClass, with the
identity values for the given class set. | [
"Get",
"an",
"array",
"containing",
"Objects",
"of",
"type",
"objClass",
"with",
"the",
"identity",
"values",
"for",
"the",
"given",
"class",
"set",
"."
] | 7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d | https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/sandbox/sandbox-common/src/main/java/com/twelvemonkeys/sql/ObjectReader.java#L210-L278 |
62,422 | haraldk/TwelveMonkeys | sandbox/sandbox-common/src/main/java/com/twelvemonkeys/sql/ObjectReader.java | ObjectReader.readObject | public Object readObject(DatabaseReadable pReadable) throws SQLException {
return readObject(pReadable.getId(), pReadable.getClass(),
pReadable.getMapping());
} | java | public Object readObject(DatabaseReadable pReadable) throws SQLException {
return readObject(pReadable.getId(), pReadable.getClass(),
pReadable.getMapping());
} | [
"public",
"Object",
"readObject",
"(",
"DatabaseReadable",
"pReadable",
")",
"throws",
"SQLException",
"{",
"return",
"readObject",
"(",
"pReadable",
".",
"getId",
"(",
")",
",",
"pReadable",
".",
"getClass",
"(",
")",
",",
"pReadable",
".",
"getMapping",
"(",... | Reads one object implementing the DatabaseReadable interface from the
database.
@param readable A DatabaseReadable object
@return The Object read, or null in no object is found | [
"Reads",
"one",
"object",
"implementing",
"the",
"DatabaseReadable",
"interface",
"from",
"the",
"database",
"."
] | 7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d | https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/sandbox/sandbox-common/src/main/java/com/twelvemonkeys/sql/ObjectReader.java#L289-L292 |
62,423 | haraldk/TwelveMonkeys | sandbox/sandbox-common/src/main/java/com/twelvemonkeys/sql/ObjectReader.java | ObjectReader.readObject | public Object readObject(Object pId, Class pObjClass, Hashtable pMapping)
throws SQLException {
return readObject(pId, pObjClass, pMapping, null);
} | java | public Object readObject(Object pId, Class pObjClass, Hashtable pMapping)
throws SQLException {
return readObject(pId, pObjClass, pMapping, null);
} | [
"public",
"Object",
"readObject",
"(",
"Object",
"pId",
",",
"Class",
"pObjClass",
",",
"Hashtable",
"pMapping",
")",
"throws",
"SQLException",
"{",
"return",
"readObject",
"(",
"pId",
",",
"pObjClass",
",",
"pMapping",
",",
"null",
")",
";",
"}"
] | Reads the object with the given id from the database, using the given
mapping.
@param id An object uniquely identifying the object to read
@param objClass The clas
@return The Object read, or null in no object is found | [
"Reads",
"the",
"object",
"with",
"the",
"given",
"id",
"from",
"the",
"database",
"using",
"the",
"given",
"mapping",
"."
] | 7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d | https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/sandbox/sandbox-common/src/main/java/com/twelvemonkeys/sql/ObjectReader.java#L303-L306 |
62,424 | haraldk/TwelveMonkeys | sandbox/sandbox-common/src/main/java/com/twelvemonkeys/sql/ObjectReader.java | ObjectReader.readObjects | public Object[] readObjects(DatabaseReadable pReadable)
throws SQLException {
return readObjects(pReadable.getClass(),
pReadable.getMapping(), null);
} | java | public Object[] readObjects(DatabaseReadable pReadable)
throws SQLException {
return readObjects(pReadable.getClass(),
pReadable.getMapping(), null);
} | [
"public",
"Object",
"[",
"]",
"readObjects",
"(",
"DatabaseReadable",
"pReadable",
")",
"throws",
"SQLException",
"{",
"return",
"readObjects",
"(",
"pReadable",
".",
"getClass",
"(",
")",
",",
"pReadable",
".",
"getMapping",
"(",
")",
",",
"null",
")",
";",... | Reads all the objects of the given type from the
database. The object must implement the DatabaseReadable interface.
@return An array of Objects, or an zero-length array if none was found | [
"Reads",
"all",
"the",
"objects",
"of",
"the",
"given",
"type",
"from",
"the",
"database",
".",
"The",
"object",
"must",
"implement",
"the",
"DatabaseReadable",
"interface",
"."
] | 7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d | https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/sandbox/sandbox-common/src/main/java/com/twelvemonkeys/sql/ObjectReader.java#L315-L319 |
62,425 | haraldk/TwelveMonkeys | sandbox/sandbox-common/src/main/java/com/twelvemonkeys/sql/ObjectReader.java | ObjectReader.setPropertyValue | private void setPropertyValue(Object pObj, String pProperty,
Object pValue) {
Method m = null;
Class[] cl = {pValue.getClass()};
try {
//Util.setPropertyValue(pObj, pProperty, pValue);
// Find method
m... | java | private void setPropertyValue(Object pObj, String pProperty,
Object pValue) {
Method m = null;
Class[] cl = {pValue.getClass()};
try {
//Util.setPropertyValue(pObj, pProperty, pValue);
// Find method
m... | [
"private",
"void",
"setPropertyValue",
"(",
"Object",
"pObj",
",",
"String",
"pProperty",
",",
"Object",
"pValue",
")",
"{",
"Method",
"m",
"=",
"null",
";",
"Class",
"[",
"]",
"cl",
"=",
"{",
"pValue",
".",
"getClass",
"(",
")",
"}",
";",
"try",
"{"... | Sets the property value to an object using reflection
@param obj The object to get a property from
@param property The name of the property
@param value The property value | [
"Sets",
"the",
"property",
"value",
"to",
"an",
"object",
"using",
"reflection"
] | 7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d | https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/sandbox/sandbox-common/src/main/java/com/twelvemonkeys/sql/ObjectReader.java#L330-L357 |
62,426 | haraldk/TwelveMonkeys | sandbox/sandbox-common/src/main/java/com/twelvemonkeys/sql/ObjectReader.java | ObjectReader.getPropertyValue | private Object getPropertyValue(Object pObj, String pProperty) {
Method m = null;
Class[] cl = new Class[0];
try {
//return Util.getPropertyValue(pObj, pProperty);
// Find method
m = pObj.getClass().
getMethod("get" + String... | java | private Object getPropertyValue(Object pObj, String pProperty) {
Method m = null;
Class[] cl = new Class[0];
try {
//return Util.getPropertyValue(pObj, pProperty);
// Find method
m = pObj.getClass().
getMethod("get" + String... | [
"private",
"Object",
"getPropertyValue",
"(",
"Object",
"pObj",
",",
"String",
"pProperty",
")",
"{",
"Method",
"m",
"=",
"null",
";",
"Class",
"[",
"]",
"cl",
"=",
"new",
"Class",
"[",
"0",
"]",
";",
"try",
"{",
"//return Util.getPropertyValue(pObj, pProper... | Gets the property value from an object using reflection
@param obj The object to get a property from
@param property The name of the property
@return The property value as an Object | [
"Gets",
"the",
"property",
"value",
"from",
"an",
"object",
"using",
"reflection"
] | 7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d | https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/sandbox/sandbox-common/src/main/java/com/twelvemonkeys/sql/ObjectReader.java#L368-L395 |
62,427 | haraldk/TwelveMonkeys | sandbox/sandbox-common/src/main/java/com/twelvemonkeys/sql/ObjectReader.java | ObjectReader.setChildObjects | private void setChildObjects(Object pParent, ObjectMapper pOM)
throws SQLException {
if (pOM == null) {
throw new NullPointerException("ObjectMapper in readChildObjects "
+ "cannot be null!!");
}
for (Enumeration keys = pOM.m... | java | private void setChildObjects(Object pParent, ObjectMapper pOM)
throws SQLException {
if (pOM == null) {
throw new NullPointerException("ObjectMapper in readChildObjects "
+ "cannot be null!!");
}
for (Enumeration keys = pOM.m... | [
"private",
"void",
"setChildObjects",
"(",
"Object",
"pParent",
",",
"ObjectMapper",
"pOM",
")",
"throws",
"SQLException",
"{",
"if",
"(",
"pOM",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"\"ObjectMapper in readChildObjects \"",
"+",
"\"... | Reads and sets the child properties of the given parent object.
@param parent The object to set the child obects to.
@param om The ObjectMapper of the parent object. | [
"Reads",
"and",
"sets",
"the",
"child",
"properties",
"of",
"the",
"given",
"parent",
"object",
"."
] | 7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d | https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/sandbox/sandbox-common/src/main/java/com/twelvemonkeys/sql/ObjectReader.java#L404-L499 |
62,428 | haraldk/TwelveMonkeys | sandbox/sandbox-common/src/main/java/com/twelvemonkeys/sql/ObjectReader.java | ObjectReader.buildWhereClause | private String buildWhereClause(String[] pKeys, Hashtable pMapping) {
StringBuilder sqlBuf = new StringBuilder();
for (int i = 0; i < pKeys.length; i++) {
String column = (String) pMapping.get(pKeys[i]);
sqlBuf.append(" AND ");
sqlBuf.append(column);
... | java | private String buildWhereClause(String[] pKeys, Hashtable pMapping) {
StringBuilder sqlBuf = new StringBuilder();
for (int i = 0; i < pKeys.length; i++) {
String column = (String) pMapping.get(pKeys[i]);
sqlBuf.append(" AND ");
sqlBuf.append(column);
... | [
"private",
"String",
"buildWhereClause",
"(",
"String",
"[",
"]",
"pKeys",
",",
"Hashtable",
"pMapping",
")",
"{",
"StringBuilder",
"sqlBuf",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"pKeys",
".",
"le... | Builds extra SQL WHERE clause
@param keys An array of ID names
@param mapping The hashtable containing the object mapping
@return A string containing valid SQL | [
"Builds",
"extra",
"SQL",
"WHERE",
"clause"
] | 7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d | https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/sandbox/sandbox-common/src/main/java/com/twelvemonkeys/sql/ObjectReader.java#L524-L536 |
62,429 | haraldk/TwelveMonkeys | sandbox/sandbox-common/src/main/java/com/twelvemonkeys/sql/ObjectReader.java | ObjectReader.loadMapping | public static Properties loadMapping(Class pClass) {
try {
return SystemUtil.loadProperties(pClass);
}
catch (FileNotFoundException fnf) {
// System.err... err...
System.err.println("ERROR: " + fnf.getMessage());
}
catch (IOExcept... | java | public static Properties loadMapping(Class pClass) {
try {
return SystemUtil.loadProperties(pClass);
}
catch (FileNotFoundException fnf) {
// System.err... err...
System.err.println("ERROR: " + fnf.getMessage());
}
catch (IOExcept... | [
"public",
"static",
"Properties",
"loadMapping",
"(",
"Class",
"pClass",
")",
"{",
"try",
"{",
"return",
"SystemUtil",
".",
"loadProperties",
"(",
"pClass",
")",
";",
"}",
"catch",
"(",
"FileNotFoundException",
"fnf",
")",
"{",
"// System.err... err... \r",
"Sys... | Utility method for reading a property mapping from a properties-file | [
"Utility",
"method",
"for",
"reading",
"a",
"property",
"mapping",
"from",
"a",
"properties",
"-",
"file"
] | 7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d | https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/sandbox/sandbox-common/src/main/java/com/twelvemonkeys/sql/ObjectReader.java#L822-L834 |
62,430 | haraldk/TwelveMonkeys | sandbox/sandbox-common/src/main/java/com/twelvemonkeys/sql/ObjectManager.java | ObjectManager.getType | protected Class getType(String pType) {
Class cl = (Class) mTypes.get(pType);
if (cl == null) {
// throw new NoSuchTypeException();
}
return cl;
} | java | protected Class getType(String pType) {
Class cl = (Class) mTypes.get(pType);
if (cl == null) {
// throw new NoSuchTypeException();
}
return cl;
} | [
"protected",
"Class",
"getType",
"(",
"String",
"pType",
")",
"{",
"Class",
"cl",
"=",
"(",
"Class",
")",
"mTypes",
".",
"get",
"(",
"pType",
")",
";",
"if",
"(",
"cl",
"==",
"null",
")",
"{",
"// throw new NoSuchTypeException();\r",
"}",
"return",
"cl",... | Gets the class for a type
@return The class for a type. If the type is not found, this method will
throw an excpetion, and will never return null. | [
"Gets",
"the",
"class",
"for",
"a",
"type"
] | 7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d | https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/sandbox/sandbox-common/src/main/java/com/twelvemonkeys/sql/ObjectManager.java#L93-L101 |
62,431 | haraldk/TwelveMonkeys | sandbox/sandbox-common/src/main/java/com/twelvemonkeys/sql/ObjectManager.java | ObjectManager.getObject | protected Object getObject(String pType)
/*throws XxxException*/ {
// Get class
Class cl = getType(pType);
// Return the new instance (requires empty public constructor)
try {
return cl.newInstance();
}
catch (Exception e) {
// throw new XxxException(e);
... | java | protected Object getObject(String pType)
/*throws XxxException*/ {
// Get class
Class cl = getType(pType);
// Return the new instance (requires empty public constructor)
try {
return cl.newInstance();
}
catch (Exception e) {
// throw new XxxException(e);
... | [
"protected",
"Object",
"getObject",
"(",
"String",
"pType",
")",
"/*throws XxxException*/",
"{",
"// Get class\r",
"Class",
"cl",
"=",
"getType",
"(",
"pType",
")",
";",
"// Return the new instance (requires empty public constructor)\r",
"try",
"{",
"return",
"cl",
".",... | Gets a java object of the class for a given type. | [
"Gets",
"a",
"java",
"object",
"of",
"the",
"class",
"for",
"a",
"given",
"type",
"."
] | 7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d | https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/sandbox/sandbox-common/src/main/java/com/twelvemonkeys/sql/ObjectManager.java#L107-L123 |
62,432 | haraldk/TwelveMonkeys | imageio/imageio-core/src/main/java/com/twelvemonkeys/imageio/ImageReaderBase.java | ImageReaderBase.checkBounds | protected void checkBounds(int index) throws IOException {
assertInput();
if (index < getMinIndex()) {
throw new IndexOutOfBoundsException("index < minIndex");
}
int numImages = getNumImages(false);
if (numImages != -1 && index >= numImages) {
throw new I... | java | protected void checkBounds(int index) throws IOException {
assertInput();
if (index < getMinIndex()) {
throw new IndexOutOfBoundsException("index < minIndex");
}
int numImages = getNumImages(false);
if (numImages != -1 && index >= numImages) {
throw new I... | [
"protected",
"void",
"checkBounds",
"(",
"int",
"index",
")",
"throws",
"IOException",
"{",
"assertInput",
"(",
")",
";",
"if",
"(",
"index",
"<",
"getMinIndex",
"(",
")",
")",
"{",
"throw",
"new",
"IndexOutOfBoundsException",
"(",
"\"index < minIndex\"",
")",... | Convenience method to make sure image index is within bounds.
@param index the image index
@throws java.io.IOException if an error occurs during reading
@throws IndexOutOfBoundsException if not {@code minIndex <= index < numImages} | [
"Convenience",
"method",
"to",
"make",
"sure",
"image",
"index",
"is",
"within",
"bounds",
"."
] | 7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d | https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/imageio/imageio-core/src/main/java/com/twelvemonkeys/imageio/ImageReaderBase.java#L183-L193 |
62,433 | haraldk/TwelveMonkeys | imageio/imageio-core/src/main/java/com/twelvemonkeys/imageio/ImageReaderBase.java | ImageReaderBase.hasExplicitDestination | protected static boolean hasExplicitDestination(final ImageReadParam pParam) {
return pParam != null &&
(
pParam.getDestination() != null || pParam.getDestinationType() != null ||
!ORIGIN.equals(pParam.getDestinationOffset())
... | java | protected static boolean hasExplicitDestination(final ImageReadParam pParam) {
return pParam != null &&
(
pParam.getDestination() != null || pParam.getDestinationType() != null ||
!ORIGIN.equals(pParam.getDestinationOffset())
... | [
"protected",
"static",
"boolean",
"hasExplicitDestination",
"(",
"final",
"ImageReadParam",
"pParam",
")",
"{",
"return",
"pParam",
"!=",
"null",
"&&",
"(",
"pParam",
".",
"getDestination",
"(",
")",
"!=",
"null",
"||",
"pParam",
".",
"getDestinationType",
"(",
... | Tests if param has explicit destination.
@param pParam the image read parameter, or {@code null}
@return true if {@code pParam} is non-{@code null} and either its {@code getDestination},
{@code getDestinationType} returns a non-{@code null} value,
or {@code getDestinationOffset} returns a {@link Point} that is not the... | [
"Tests",
"if",
"param",
"has",
"explicit",
"destination",
"."
] | 7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d | https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/imageio/imageio-core/src/main/java/com/twelvemonkeys/imageio/ImageReaderBase.java#L371-L377 |
62,434 | haraldk/TwelveMonkeys | servlet/src/main/java/com/twelvemonkeys/servlet/image/ImageServletResponseImpl.java | ImageServletResponseImpl.getImage | public BufferedImage getImage() throws IOException {
if (image == null) {
// No content, no image
if (bufferedOut == null) {
return null;
}
// Read from the byte buffer
InputStream byteStream = bufferedOut.createInputStream();
... | java | public BufferedImage getImage() throws IOException {
if (image == null) {
// No content, no image
if (bufferedOut == null) {
return null;
}
// Read from the byte buffer
InputStream byteStream = bufferedOut.createInputStream();
... | [
"public",
"BufferedImage",
"getImage",
"(",
")",
"throws",
"IOException",
"{",
"if",
"(",
"image",
"==",
"null",
")",
"{",
"// No content, no image\r",
"if",
"(",
"bufferedOut",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"// Read from the byte buffer\r"... | Gets the decoded image from the response.
@return a {@code BufferedImage} or {@code null} if the image could
not be read.
@throws java.io.IOException if an I/O exception occurs during reading | [
"Gets",
"the",
"decoded",
"image",
"from",
"the",
"response",
"."
] | 7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d | https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/servlet/src/main/java/com/twelvemonkeys/servlet/image/ImageServletResponseImpl.java#L331-L430 |
62,435 | haraldk/TwelveMonkeys | imageio/imageio-pict/src/main/java/com/twelvemonkeys/imageio/plugins/pict/QuickTime.java | QuickTime.getDecompressor | private static QTDecompressor getDecompressor(final ImageDesc pDescription) {
for (QTDecompressor decompressor : sDecompressors) {
if (decompressor.canDecompress(pDescription)) {
return decompressor;
}
}
return null;
} | java | private static QTDecompressor getDecompressor(final ImageDesc pDescription) {
for (QTDecompressor decompressor : sDecompressors) {
if (decompressor.canDecompress(pDescription)) {
return decompressor;
}
}
return null;
} | [
"private",
"static",
"QTDecompressor",
"getDecompressor",
"(",
"final",
"ImageDesc",
"pDescription",
")",
"{",
"for",
"(",
"QTDecompressor",
"decompressor",
":",
"sDecompressors",
")",
"{",
"if",
"(",
"decompressor",
".",
"canDecompress",
"(",
"pDescription",
")",
... | Gets a decompressor that can decompress the described data.
@param pDescription the image description ({@code 'idsc'} Atom).
@return a decompressor that can decompress data decribed by the given {@link ImageDesc description},
or {@code null} if no decompressor is found | [
"Gets",
"a",
"decompressor",
"that",
"can",
"decompress",
"the",
"described",
"data",
"."
] | 7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d | https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/imageio/imageio-pict/src/main/java/com/twelvemonkeys/imageio/plugins/pict/QuickTime.java#L124-L132 |
62,436 | haraldk/TwelveMonkeys | imageio/imageio-pict/src/main/java/com/twelvemonkeys/imageio/plugins/pict/QuickTime.java | QuickTime.decompress | public static BufferedImage decompress(final ImageInputStream pStream) throws IOException {
ImageDesc description = ImageDesc.read(pStream);
if (PICTImageReader.DEBUG) {
System.out.println(description);
}
QTDecompressor decompressor = getDecompressor(description);
... | java | public static BufferedImage decompress(final ImageInputStream pStream) throws IOException {
ImageDesc description = ImageDesc.read(pStream);
if (PICTImageReader.DEBUG) {
System.out.println(description);
}
QTDecompressor decompressor = getDecompressor(description);
... | [
"public",
"static",
"BufferedImage",
"decompress",
"(",
"final",
"ImageInputStream",
"pStream",
")",
"throws",
"IOException",
"{",
"ImageDesc",
"description",
"=",
"ImageDesc",
".",
"read",
"(",
"pStream",
")",
";",
"if",
"(",
"PICTImageReader",
".",
"DEBUG",
")... | Decompresses the QuickTime image data from the given stream.
@param pStream the image input stream
@return a {@link BufferedImage} containing the image data, or {@code null} if no decompressor is capable of
decompressing the image.
@throws IOException if an I/O exception occurs during read | [
"Decompresses",
"the",
"QuickTime",
"image",
"data",
"from",
"the",
"given",
"stream",
"."
] | 7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d | https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/imageio/imageio-pict/src/main/java/com/twelvemonkeys/imageio/plugins/pict/QuickTime.java#L142-L162 |
62,437 | haraldk/TwelveMonkeys | servlet/src/main/java/com/twelvemonkeys/servlet/image/ContentNegotiationFilter.java | ContentNegotiationFilter.trigger | protected boolean trigger(ServletRequest pRequest) {
boolean trigger = false;
if (pRequest instanceof HttpServletRequest) {
HttpServletRequest request = (HttpServletRequest) pRequest;
String accept = getAcceptedFormats(request);
String originalFormat = getServl... | java | protected boolean trigger(ServletRequest pRequest) {
boolean trigger = false;
if (pRequest instanceof HttpServletRequest) {
HttpServletRequest request = (HttpServletRequest) pRequest;
String accept = getAcceptedFormats(request);
String originalFormat = getServl... | [
"protected",
"boolean",
"trigger",
"(",
"ServletRequest",
"pRequest",
")",
"{",
"boolean",
"trigger",
"=",
"false",
";",
"if",
"(",
"pRequest",
"instanceof",
"HttpServletRequest",
")",
"{",
"HttpServletRequest",
"request",
"=",
"(",
"HttpServletRequest",
")",
"pRe... | Makes sure the filter triggers for unknown file formats.
@param pRequest the request
@return {@code true} if the filter should execute, {@code false}
otherwise | [
"Makes",
"sure",
"the",
"filter",
"triggers",
"for",
"unknown",
"file",
"formats",
"."
] | 7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d | https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/servlet/src/main/java/com/twelvemonkeys/servlet/image/ContentNegotiationFilter.java#L155-L175 |
62,438 | haraldk/TwelveMonkeys | servlet/src/main/java/com/twelvemonkeys/servlet/image/ContentNegotiationFilter.java | ContentNegotiationFilter.findBestFormat | private static String findBestFormat(Map<String, Float> pFormatQuality) {
String acceptable = null;
float acceptQuality = 0.0f;
for (Map.Entry<String, Float> entry : pFormatQuality.entrySet()) {
float qValue = entry.getValue();
if (qValue > acceptQuality) {
... | java | private static String findBestFormat(Map<String, Float> pFormatQuality) {
String acceptable = null;
float acceptQuality = 0.0f;
for (Map.Entry<String, Float> entry : pFormatQuality.entrySet()) {
float qValue = entry.getValue();
if (qValue > acceptQuality) {
... | [
"private",
"static",
"String",
"findBestFormat",
"(",
"Map",
"<",
"String",
",",
"Float",
">",
"pFormatQuality",
")",
"{",
"String",
"acceptable",
"=",
"null",
";",
"float",
"acceptQuality",
"=",
"0.0f",
";",
"for",
"(",
"Map",
".",
"Entry",
"<",
"String",... | Finds the best available format.
@param pFormatQuality the format to quality mapping
@return the mime type of the best available format | [
"Finds",
"the",
"best",
"available",
"format",
"."
] | 7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d | https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/servlet/src/main/java/com/twelvemonkeys/servlet/image/ContentNegotiationFilter.java#L275-L289 |
62,439 | haraldk/TwelveMonkeys | servlet/src/main/java/com/twelvemonkeys/servlet/image/ContentNegotiationFilter.java | ContentNegotiationFilter.adjustQualityFromAccept | private void adjustQualityFromAccept(Map<String, Float> pFormatQuality, HttpServletRequest pRequest) {
// Multiply all q factors with qs factors
// No q=.. should be interpreted as q=1.0
// Apache does some extras; if both explicit types and wildcards
// (without qaulity factor) ar... | java | private void adjustQualityFromAccept(Map<String, Float> pFormatQuality, HttpServletRequest pRequest) {
// Multiply all q factors with qs factors
// No q=.. should be interpreted as q=1.0
// Apache does some extras; if both explicit types and wildcards
// (without qaulity factor) ar... | [
"private",
"void",
"adjustQualityFromAccept",
"(",
"Map",
"<",
"String",
",",
"Float",
">",
"pFormatQuality",
",",
"HttpServletRequest",
"pRequest",
")",
"{",
"// Multiply all q factors with qs factors\r",
"// No q=.. should be interpreted as q=1.0\r",
"// Apache does some extras... | Adjust quality from HTTP Accept header
@param pFormatQuality the format to quality mapping
@param pRequest the request | [
"Adjust",
"quality",
"from",
"HTTP",
"Accept",
"header"
] | 7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d | https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/servlet/src/main/java/com/twelvemonkeys/servlet/image/ContentNegotiationFilter.java#L297-L323 |
62,440 | haraldk/TwelveMonkeys | servlet/src/main/java/com/twelvemonkeys/servlet/image/ContentNegotiationFilter.java | ContentNegotiationFilter.adjustQualityFromImage | private static void adjustQualityFromImage(Map<String, Float> pFormatQuality, BufferedImage pImage) {
// NOTE: The values are all made-up. May need tuning.
// If pImage.getColorModel() instanceof IndexColorModel
// JPEG qs*=0.6
// If NOT binary or 2 color index
// ... | java | private static void adjustQualityFromImage(Map<String, Float> pFormatQuality, BufferedImage pImage) {
// NOTE: The values are all made-up. May need tuning.
// If pImage.getColorModel() instanceof IndexColorModel
// JPEG qs*=0.6
// If NOT binary or 2 color index
// ... | [
"private",
"static",
"void",
"adjustQualityFromImage",
"(",
"Map",
"<",
"String",
",",
"Float",
">",
"pFormatQuality",
",",
"BufferedImage",
"pImage",
")",
"{",
"// NOTE: The values are all made-up. May need tuning.\r",
"// If pImage.getColorModel() instanceof IndexColorModel\r",... | Adjusts source quality settings from image properties.
@param pFormatQuality the format to quality mapping
@param pImage the image | [
"Adjusts",
"source",
"quality",
"settings",
"from",
"image",
"properties",
"."
] | 7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d | https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/servlet/src/main/java/com/twelvemonkeys/servlet/image/ContentNegotiationFilter.java#L375-L410 |
62,441 | haraldk/TwelveMonkeys | servlet/src/main/java/com/twelvemonkeys/servlet/image/ContentNegotiationFilter.java | ContentNegotiationFilter.adjustQuality | private static void adjustQuality(Map<String, Float> pFormatQuality, String pFormat, float pFactor) {
Float oldValue = pFormatQuality.get(pFormat);
if (oldValue != null) {
pFormatQuality.put(pFormat, oldValue * pFactor);
//System.out.println("New vallue after multiplying with... | java | private static void adjustQuality(Map<String, Float> pFormatQuality, String pFormat, float pFactor) {
Float oldValue = pFormatQuality.get(pFormat);
if (oldValue != null) {
pFormatQuality.put(pFormat, oldValue * pFactor);
//System.out.println("New vallue after multiplying with... | [
"private",
"static",
"void",
"adjustQuality",
"(",
"Map",
"<",
"String",
",",
"Float",
">",
"pFormatQuality",
",",
"String",
"pFormat",
",",
"float",
"pFactor",
")",
"{",
"Float",
"oldValue",
"=",
"pFormatQuality",
".",
"get",
"(",
"pFormat",
")",
";",
"if... | Updates the quality in the map.
@param pFormatQuality Map<String,Float>
@param pFormat the format
@param pFactor the quality factor | [
"Updates",
"the",
"quality",
"in",
"the",
"map",
"."
] | 7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d | https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/servlet/src/main/java/com/twelvemonkeys/servlet/image/ContentNegotiationFilter.java#L419-L425 |
62,442 | haraldk/TwelveMonkeys | servlet/src/main/java/com/twelvemonkeys/servlet/image/ContentNegotiationFilter.java | ContentNegotiationFilter.getKnownFormatQuality | private float getKnownFormatQuality(String pFormat) {
for (int i = 0; i < sKnownFormats.length; i++) {
if (pFormat.equals(sKnownFormats[i])) {
return knownFormatQuality[i];
}
}
return 0.1f;
} | java | private float getKnownFormatQuality(String pFormat) {
for (int i = 0; i < sKnownFormats.length; i++) {
if (pFormat.equals(sKnownFormats[i])) {
return knownFormatQuality[i];
}
}
return 0.1f;
} | [
"private",
"float",
"getKnownFormatQuality",
"(",
"String",
"pFormat",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"sKnownFormats",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"pFormat",
".",
"equals",
"(",
"sKnownFormats",
"[",
... | Gets the initial quality if this is a known format, otherwise 0.1
@param pFormat the format name
@return the q factor of the given format | [
"Gets",
"the",
"initial",
"quality",
"if",
"this",
"is",
"a",
"known",
"format",
"otherwise",
"0",
".",
"1"
] | 7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d | https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/servlet/src/main/java/com/twelvemonkeys/servlet/image/ContentNegotiationFilter.java#L434-L441 |
62,443 | haraldk/TwelveMonkeys | servlet/src/main/java/com/twelvemonkeys/servlet/OutputStreamAdapter.java | OutputStreamAdapter.write | public void write(final byte pBytes[], final int pOff, final int pLen) throws IOException {
out.write(pBytes, pOff, pLen);
} | java | public void write(final byte pBytes[], final int pOff, final int pLen) throws IOException {
out.write(pBytes, pOff, pLen);
} | [
"public",
"void",
"write",
"(",
"final",
"byte",
"pBytes",
"[",
"]",
",",
"final",
"int",
"pOff",
",",
"final",
"int",
"pLen",
")",
"throws",
"IOException",
"{",
"out",
".",
"write",
"(",
"pBytes",
",",
"pOff",
",",
"pLen",
")",
";",
"}"
] | Overide for efficiency | [
"Overide",
"for",
"efficiency"
] | 7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d | https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/servlet/src/main/java/com/twelvemonkeys/servlet/OutputStreamAdapter.java#L119-L121 |
62,444 | haraldk/TwelveMonkeys | common/common-io/src/main/java/com/twelvemonkeys/io/enc/PackBitsDecoder.java | PackBitsDecoder.decode | public int decode(final InputStream stream, final ByteBuffer buffer) throws IOException {
if (reachedEOF) {
return -1;
}
// TODO: Don't decode more than single runs, because some writers add pad bytes inside the stream...
while (buffer.hasRemaining()) {
in... | java | public int decode(final InputStream stream, final ByteBuffer buffer) throws IOException {
if (reachedEOF) {
return -1;
}
// TODO: Don't decode more than single runs, because some writers add pad bytes inside the stream...
while (buffer.hasRemaining()) {
in... | [
"public",
"int",
"decode",
"(",
"final",
"InputStream",
"stream",
",",
"final",
"ByteBuffer",
"buffer",
")",
"throws",
"IOException",
"{",
"if",
"(",
"reachedEOF",
")",
"{",
"return",
"-",
"1",
";",
"}",
"// TODO: Don't decode more than single runs, because some wri... | Decodes bytes from the given input stream, to the given buffer.
@param stream the stream to decode from
@param buffer a byte array, minimum 128 (or 129 if no-op is disabled) bytes long
@return The number of bytes decoded
@throws java.io.IOException | [
"Decodes",
"bytes",
"from",
"the",
"given",
"input",
"stream",
"to",
"the",
"given",
"buffer",
"."
] | 7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d | https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/common/common-io/src/main/java/com/twelvemonkeys/io/enc/PackBitsDecoder.java#L119-L179 |
62,445 | haraldk/TwelveMonkeys | imageio/imageio-core/src/main/java/com/twelvemonkeys/imageio/color/CIELabColorConverter.java | CIELabColorConverter.LABtoXYZ | private float[] LABtoXYZ(float L, float a, float b, float[] xyzResult) {
// Significant speedup: Removing Math.pow
float y = (L + 16.0f) / 116.0f;
float y3 = y * y * y; // Math.pow(y, 3.0);
float x = (a / 500.0f) + y;
float x3 = x * x * x; // Math.pow(x, 3.0);
float z = y... | java | private float[] LABtoXYZ(float L, float a, float b, float[] xyzResult) {
// Significant speedup: Removing Math.pow
float y = (L + 16.0f) / 116.0f;
float y3 = y * y * y; // Math.pow(y, 3.0);
float x = (a / 500.0f) + y;
float x3 = x * x * x; // Math.pow(x, 3.0);
float z = y... | [
"private",
"float",
"[",
"]",
"LABtoXYZ",
"(",
"float",
"L",
",",
"float",
"a",
",",
"float",
"b",
",",
"float",
"[",
"]",
"xyzResult",
")",
"{",
"// Significant speedup: Removing Math.pow",
"float",
"y",
"=",
"(",
"L",
"+",
"16.0f",
")",
"/",
"116.0f",
... | Convert LAB to XYZ.
@param L
@param a
@param b
@return XYZ values | [
"Convert",
"LAB",
"to",
"XYZ",
"."
] | 7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d | https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/imageio/imageio-core/src/main/java/com/twelvemonkeys/imageio/color/CIELabColorConverter.java#L88-L123 |
62,446 | haraldk/TwelveMonkeys | common/common-lang/src/main/java/com/twelvemonkeys/util/convert/NumberConverter.java | NumberConverter.toObject | public Object toObject(final String pString, final Class pType, final String pFormat) throws ConversionException {
if (StringUtil.isEmpty(pString)) {
return null;
}
try {
if (pType.equals(BigInteger.class)) {
return new BigInteger(pString); // No f... | java | public Object toObject(final String pString, final Class pType, final String pFormat) throws ConversionException {
if (StringUtil.isEmpty(pString)) {
return null;
}
try {
if (pType.equals(BigInteger.class)) {
return new BigInteger(pString); // No f... | [
"public",
"Object",
"toObject",
"(",
"final",
"String",
"pString",
",",
"final",
"Class",
"pType",
",",
"final",
"String",
"pFormat",
")",
"throws",
"ConversionException",
"{",
"if",
"(",
"StringUtil",
".",
"isEmpty",
"(",
"pString",
")",
")",
"{",
"return",... | Converts the string to a number, using the given format for parsing.
@param pString the string to convert.
@param pType the type to convert to. PropertyConverter
implementations may choose to ignore this parameter.
@param pFormat the format used for parsing. PropertyConverter
implementations may choose to ignore this ... | [
"Converts",
"the",
"string",
"to",
"a",
"number",
"using",
"the",
"given",
"format",
"for",
"parsing",
"."
] | 7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d | https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/common/common-lang/src/main/java/com/twelvemonkeys/util/convert/NumberConverter.java#L83-L139 |
62,447 | haraldk/TwelveMonkeys | imageio/imageio-pict/src/main/java/com/twelvemonkeys/imageio/plugins/pict/QuickDrawContext.java | QuickDrawContext.setPenSize | public void setPenSize(Dimension2D pSize) {
penSize.setSize(pSize);
graphics.setStroke(getStroke(penSize));
} | java | public void setPenSize(Dimension2D pSize) {
penSize.setSize(pSize);
graphics.setStroke(getStroke(penSize));
} | [
"public",
"void",
"setPenSize",
"(",
"Dimension2D",
"pSize",
")",
"{",
"penSize",
".",
"setSize",
"(",
"pSize",
")",
";",
"graphics",
".",
"setStroke",
"(",
"getStroke",
"(",
"penSize",
")",
")",
";",
"}"
] | Sets the pen size.
PenSize
@param pSize the new size | [
"Sets",
"the",
"pen",
"size",
".",
"PenSize"
] | 7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d | https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/imageio/imageio-pict/src/main/java/com/twelvemonkeys/imageio/plugins/pict/QuickDrawContext.java#L274-L277 |
62,448 | haraldk/TwelveMonkeys | imageio/imageio-pict/src/main/java/com/twelvemonkeys/imageio/plugins/pict/QuickDrawContext.java | QuickDrawContext.setupForFill | protected void setupForFill(final Pattern pPattern) {
graphics.setPaint(pPattern);
graphics.setComposite(getCompositeFor(QuickDraw.PAT_COPY));
} | java | protected void setupForFill(final Pattern pPattern) {
graphics.setPaint(pPattern);
graphics.setComposite(getCompositeFor(QuickDraw.PAT_COPY));
} | [
"protected",
"void",
"setupForFill",
"(",
"final",
"Pattern",
"pPattern",
")",
"{",
"graphics",
".",
"setPaint",
"(",
"pPattern",
")",
";",
"graphics",
".",
"setComposite",
"(",
"getCompositeFor",
"(",
"QuickDraw",
".",
"PAT_COPY",
")",
")",
";",
"}"
] | Sets up paint context for fill.
@param pPattern the pattern to use for filling. | [
"Sets",
"up",
"paint",
"context",
"for",
"fill",
"."
] | 7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d | https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/imageio/imageio-pict/src/main/java/com/twelvemonkeys/imageio/plugins/pict/QuickDrawContext.java#L440-L443 |
62,449 | haraldk/TwelveMonkeys | imageio/imageio-pict/src/main/java/com/twelvemonkeys/imageio/plugins/pict/QuickDrawContext.java | QuickDrawContext.toArc | private static Arc2D.Double toArc(final Rectangle2D pRectangle, int pStartAngle, int pArcAngle, final boolean pClosed) {
return new Arc2D.Double(pRectangle, 90 - pStartAngle, -pArcAngle, pClosed ? Arc2D.PIE : Arc2D.OPEN);
} | java | private static Arc2D.Double toArc(final Rectangle2D pRectangle, int pStartAngle, int pArcAngle, final boolean pClosed) {
return new Arc2D.Double(pRectangle, 90 - pStartAngle, -pArcAngle, pClosed ? Arc2D.PIE : Arc2D.OPEN);
} | [
"private",
"static",
"Arc2D",
".",
"Double",
"toArc",
"(",
"final",
"Rectangle2D",
"pRectangle",
",",
"int",
"pStartAngle",
",",
"int",
"pArcAngle",
",",
"final",
"boolean",
"pClosed",
")",
"{",
"return",
"new",
"Arc2D",
".",
"Double",
"(",
"pRectangle",
","... | Converts a rectangle to an arc.
@param pRectangle the framing rectangle
@param pStartAngle start angle in degrees (starting from 12'o clock, this differs from Java)
@param pArcAngle rotation angle in degrees (starting from {@code pStartAngle}, this differs from Java arcs)
@param pClosed specifies if the arc sho... | [
"Converts",
"a",
"rectangle",
"to",
"an",
"arc",
"."
] | 7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d | https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/imageio/imageio-pict/src/main/java/com/twelvemonkeys/imageio/plugins/pict/QuickDrawContext.java#L716-L718 |
62,450 | haraldk/TwelveMonkeys | imageio/imageio-pict/src/main/java/com/twelvemonkeys/imageio/plugins/pict/QuickDrawContext.java | QuickDrawContext.drawString | public void drawString(String pString) {
setupForText();
graphics.drawString(pString, (float) getPenPosition().getX(), (float) getPenPosition().getY());
} | java | public void drawString(String pString) {
setupForText();
graphics.drawString(pString, (float) getPenPosition().getX(), (float) getPenPosition().getY());
} | [
"public",
"void",
"drawString",
"(",
"String",
"pString",
")",
"{",
"setupForText",
"(",
")",
";",
"graphics",
".",
"drawString",
"(",
"pString",
",",
"(",
"float",
")",
"getPenPosition",
"(",
")",
".",
"getX",
"(",
")",
",",
"(",
"float",
")",
"getPen... | DrawString - draws the text of a Pascal string.
@param pString a Pascal string (a string of length less than or equal to 255 chars). | [
"DrawString",
"-",
"draws",
"the",
"text",
"of",
"a",
"Pascal",
"string",
"."
] | 7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d | https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/imageio/imageio-pict/src/main/java/com/twelvemonkeys/imageio/plugins/pict/QuickDrawContext.java#L1012-L1015 |
62,451 | haraldk/TwelveMonkeys | imageio/imageio-pict/src/main/java/com/twelvemonkeys/imageio/plugins/pict/PICTUtil.java | PICTUtil.readDimension | public static Dimension readDimension(final DataInput pStream) throws IOException {
int h = pStream.readShort();
int v = pStream.readShort();
return new Dimension(h, v);
} | java | public static Dimension readDimension(final DataInput pStream) throws IOException {
int h = pStream.readShort();
int v = pStream.readShort();
return new Dimension(h, v);
} | [
"public",
"static",
"Dimension",
"readDimension",
"(",
"final",
"DataInput",
"pStream",
")",
"throws",
"IOException",
"{",
"int",
"h",
"=",
"pStream",
".",
"readShort",
"(",
")",
";",
"int",
"v",
"=",
"pStream",
".",
"readShort",
"(",
")",
";",
"return",
... | Reads a dimension from the given stream.
@param pStream the input stream
@return the dimension read
@throws java.io.IOException if an I/O error occurs during read | [
"Reads",
"a",
"dimension",
"from",
"the",
"given",
"stream",
"."
] | 7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d | https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/imageio/imageio-pict/src/main/java/com/twelvemonkeys/imageio/plugins/pict/PICTUtil.java#L90-L94 |
62,452 | haraldk/TwelveMonkeys | imageio/imageio-pict/src/main/java/com/twelvemonkeys/imageio/plugins/pict/PICTUtil.java | PICTUtil.readStr31 | public static String readStr31(final DataInput pStream) throws IOException {
String text = readPascalString(pStream);
int length = 31 - text.length();
if (length < 0) {
throw new IOException("String length exceeds maximum (31): " + text.length());
}
pStream.skipBytes(... | java | public static String readStr31(final DataInput pStream) throws IOException {
String text = readPascalString(pStream);
int length = 31 - text.length();
if (length < 0) {
throw new IOException("String length exceeds maximum (31): " + text.length());
}
pStream.skipBytes(... | [
"public",
"static",
"String",
"readStr31",
"(",
"final",
"DataInput",
"pStream",
")",
"throws",
"IOException",
"{",
"String",
"text",
"=",
"readPascalString",
"(",
"pStream",
")",
";",
"int",
"length",
"=",
"31",
"-",
"text",
".",
"length",
"(",
")",
";",
... | Reads a 32 byte fixed length Pascal string from the given input.
The input stream must be positioned at the length byte of the text,
the text will be no longer than 31 characters long.
@param pStream the input stream
@return the text read
@throws IOException if an I/O exception occurs during reading | [
"Reads",
"a",
"32",
"byte",
"fixed",
"length",
"Pascal",
"string",
"from",
"the",
"given",
"input",
".",
"The",
"input",
"stream",
"must",
"be",
"positioned",
"at",
"the",
"length",
"byte",
"of",
"the",
"text",
"the",
"text",
"will",
"be",
"no",
"longer"... | 7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d | https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/imageio/imageio-pict/src/main/java/com/twelvemonkeys/imageio/plugins/pict/PICTUtil.java#L106-L114 |
62,453 | haraldk/TwelveMonkeys | imageio/imageio-pict/src/main/java/com/twelvemonkeys/imageio/plugins/pict/PICTUtil.java | PICTUtil.readPascalString | public static String readPascalString(final DataInput pStream) throws IOException {
// Get as many bytes as indicated by byte count
int length = pStream.readUnsignedByte();
byte[] bytes = new byte[length];
pStream.readFully(bytes, 0, length);
return new String(bytes, ENCODING);... | java | public static String readPascalString(final DataInput pStream) throws IOException {
// Get as many bytes as indicated by byte count
int length = pStream.readUnsignedByte();
byte[] bytes = new byte[length];
pStream.readFully(bytes, 0, length);
return new String(bytes, ENCODING);... | [
"public",
"static",
"String",
"readPascalString",
"(",
"final",
"DataInput",
"pStream",
")",
"throws",
"IOException",
"{",
"// Get as many bytes as indicated by byte count",
"int",
"length",
"=",
"pStream",
".",
"readUnsignedByte",
"(",
")",
";",
"byte",
"[",
"]",
"... | Reads a Pascal String from the given stream.
The input stream must be positioned at the length byte of the text,
which can thus be a maximum of 255 characters long.
@param pStream the input stream
@return the text read
@throws IOException if an I/O exception occurs during reading | [
"Reads",
"a",
"Pascal",
"String",
"from",
"the",
"given",
"stream",
".",
"The",
"input",
"stream",
"must",
"be",
"positioned",
"at",
"the",
"length",
"byte",
"of",
"the",
"text",
"which",
"can",
"thus",
"be",
"a",
"maximum",
"of",
"255",
"characters",
"l... | 7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d | https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/imageio/imageio-pict/src/main/java/com/twelvemonkeys/imageio/plugins/pict/PICTUtil.java#L126-L134 |
62,454 | haraldk/TwelveMonkeys | servlet/src/main/java/com/twelvemonkeys/servlet/image/SourceRenderFilter.java | SourceRenderFilter.doFilterImpl | protected void doFilterImpl(ServletRequest pRequest, ServletResponse pResponse, FilterChain pChain) throws IOException, ServletException {
// TODO: Max size configuration, to avoid DOS attacks? OutOfMemory
// Size parameters
int width = ServletUtil.getIntParameter(pRequest, sizeWidthParam, ... | java | protected void doFilterImpl(ServletRequest pRequest, ServletResponse pResponse, FilterChain pChain) throws IOException, ServletException {
// TODO: Max size configuration, to avoid DOS attacks? OutOfMemory
// Size parameters
int width = ServletUtil.getIntParameter(pRequest, sizeWidthParam, ... | [
"protected",
"void",
"doFilterImpl",
"(",
"ServletRequest",
"pRequest",
",",
"ServletResponse",
"pResponse",
",",
"FilterChain",
"pChain",
")",
"throws",
"IOException",
",",
"ServletException",
"{",
"// TODO: Max size configuration, to avoid DOS attacks? OutOfMemory\r",
"// Siz... | Extracts request parameters, and sets the corresponding request
attributes if specified.
@param pRequest
@param pResponse
@param pChain
@throws IOException
@throws ServletException | [
"Extracts",
"request",
"parameters",
"and",
"sets",
"the",
"corresponding",
"request",
"attributes",
"if",
"specified",
"."
] | 7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d | https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/servlet/src/main/java/com/twelvemonkeys/servlet/image/SourceRenderFilter.java#L130-L170 |
62,455 | haraldk/TwelveMonkeys | sandbox/sandbox-common/src/main/java/com/twelvemonkeys/net/HttpURLConnection.java | HttpURLConnection.setTimeout | public void setTimeout(int pTimeout) {
if (pTimeout < 0) { // Must be positive
throw new IllegalArgumentException("Timeout must be positive.");
}
timeout = pTimeout;
if (socket != null) {
try {
socket.setSoTimeout(pTimeout);
}
... | java | public void setTimeout(int pTimeout) {
if (pTimeout < 0) { // Must be positive
throw new IllegalArgumentException("Timeout must be positive.");
}
timeout = pTimeout;
if (socket != null) {
try {
socket.setSoTimeout(pTimeout);
}
... | [
"public",
"void",
"setTimeout",
"(",
"int",
"pTimeout",
")",
"{",
"if",
"(",
"pTimeout",
"<",
"0",
")",
"{",
"// Must be positive",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Timeout must be positive.\"",
")",
";",
"}",
"timeout",
"=",
"pTimeout",
";",
... | Sets the read timeout for the undelying socket.
A timeout of zero is interpreted as an
infinite timeout.
@param pTimeout the maximum time the socket will block for read
operations, in milliseconds. | [
"Sets",
"the",
"read",
"timeout",
"for",
"the",
"undelying",
"socket",
".",
"A",
"timeout",
"of",
"zero",
"is",
"interpreted",
"as",
"an",
"infinite",
"timeout",
"."
] | 7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d | https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/sandbox/sandbox-common/src/main/java/com/twelvemonkeys/net/HttpURLConnection.java#L280-L293 |
62,456 | haraldk/TwelveMonkeys | sandbox/sandbox-common/src/main/java/com/twelvemonkeys/net/HttpURLConnection.java | HttpURLConnection.getInputStream | public synchronized InputStream getInputStream() throws IOException {
if (!connected) {
connect();
}
// Nothing to return
if (responseCode == HTTP_NOT_FOUND) {
throw new FileNotFoundException(url.toString());
}
int length;
if (inputStream... | java | public synchronized InputStream getInputStream() throws IOException {
if (!connected) {
connect();
}
// Nothing to return
if (responseCode == HTTP_NOT_FOUND) {
throw new FileNotFoundException(url.toString());
}
int length;
if (inputStream... | [
"public",
"synchronized",
"InputStream",
"getInputStream",
"(",
")",
"throws",
"IOException",
"{",
"if",
"(",
"!",
"connected",
")",
"{",
"connect",
"(",
")",
";",
"}",
"// Nothing to return",
"if",
"(",
"responseCode",
"==",
"HTTP_NOT_FOUND",
")",
"{",
"throw... | Returns an input stream that reads from this open connection.
@return an input stream that reads from this open connection.
@throws IOException if an I/O error occurs while
creating the input stream. | [
"Returns",
"an",
"input",
"stream",
"that",
"reads",
"from",
"this",
"open",
"connection",
"."
] | 7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d | https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/sandbox/sandbox-common/src/main/java/com/twelvemonkeys/net/HttpURLConnection.java#L322-L351 |
62,457 | haraldk/TwelveMonkeys | sandbox/sandbox-common/src/main/java/com/twelvemonkeys/net/HttpURLConnection.java | HttpURLConnection.connect | private void connect(final URL pURL, PasswordAuthentication pAuth, String pAuthType, int pRetries) throws IOException {
// Find correct port
final int port = (pURL.getPort() > 0)
? pURL.getPort()
: HTTP_DEFAULT_PORT;
// Create socket if we don't have one
... | java | private void connect(final URL pURL, PasswordAuthentication pAuth, String pAuthType, int pRetries) throws IOException {
// Find correct port
final int port = (pURL.getPort() > 0)
? pURL.getPort()
: HTTP_DEFAULT_PORT;
// Create socket if we don't have one
... | [
"private",
"void",
"connect",
"(",
"final",
"URL",
"pURL",
",",
"PasswordAuthentication",
"pAuth",
",",
"String",
"pAuthType",
",",
"int",
"pRetries",
")",
"throws",
"IOException",
"{",
"// Find correct port",
"final",
"int",
"port",
"=",
"(",
"pURL",
".",
"ge... | Internal connect method. | [
"Internal",
"connect",
"method",
"."
] | 7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d | https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/sandbox/sandbox-common/src/main/java/com/twelvemonkeys/net/HttpURLConnection.java#L391-L543 |
62,458 | haraldk/TwelveMonkeys | sandbox/sandbox-common/src/main/java/com/twelvemonkeys/net/HttpURLConnection.java | HttpURLConnection.createSocket | private Socket createSocket(final URL pURL, final int pPort, int pConnectTimeout) throws IOException {
Socket socket;
final Object current = this;
SocketConnector connector;
Thread t = new Thread(connector = new SocketConnector() {
private IOException mConnectException = nul... | java | private Socket createSocket(final URL pURL, final int pPort, int pConnectTimeout) throws IOException {
Socket socket;
final Object current = this;
SocketConnector connector;
Thread t = new Thread(connector = new SocketConnector() {
private IOException mConnectException = nul... | [
"private",
"Socket",
"createSocket",
"(",
"final",
"URL",
"pURL",
",",
"final",
"int",
"pPort",
",",
"int",
"pConnectTimeout",
")",
"throws",
"IOException",
"{",
"Socket",
"socket",
";",
"final",
"Object",
"current",
"=",
"this",
";",
"SocketConnector",
"conne... | Creates a socket to the given URL and port, with the given connect
timeout. If the socket waits more than the given timout to connect,
an ConnectException is thrown.
@param pURL the URL to connect to
@param pPort the port to connect to
@param pConnectTimeout the connect timeout
@return the created... | [
"Creates",
"a",
"socket",
"to",
"the",
"given",
"URL",
"and",
"port",
"with",
"the",
"given",
"connect",
"timeout",
".",
"If",
"the",
"socket",
"waits",
"more",
"than",
"the",
"given",
"timout",
"to",
"connect",
"an",
"ConnectException",
"is",
"thrown",
".... | 7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d | https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/sandbox/sandbox-common/src/main/java/com/twelvemonkeys/net/HttpURLConnection.java#L573-L636 |
62,459 | haraldk/TwelveMonkeys | sandbox/sandbox-common/src/main/java/com/twelvemonkeys/net/HttpURLConnection.java | HttpURLConnection.writeRequestHeaders | private static void writeRequestHeaders(OutputStream pOut, URL pURL, String pMethod, Properties pProps, boolean pUsingProxy,
PasswordAuthentication pAuth, String pAuthType) {
PrintWriter out = new PrintWriter(pOut, true); // autoFlush
if (!pUsingProxy) {
... | java | private static void writeRequestHeaders(OutputStream pOut, URL pURL, String pMethod, Properties pProps, boolean pUsingProxy,
PasswordAuthentication pAuth, String pAuthType) {
PrintWriter out = new PrintWriter(pOut, true); // autoFlush
if (!pUsingProxy) {
... | [
"private",
"static",
"void",
"writeRequestHeaders",
"(",
"OutputStream",
"pOut",
",",
"URL",
"pURL",
",",
"String",
"pMethod",
",",
"Properties",
"pProps",
",",
"boolean",
"pUsingProxy",
",",
"PasswordAuthentication",
"pAuth",
",",
"String",
"pAuthType",
")",
"{",... | Writes the HTTP request headers, for HTTP GET method.
@see <A href="http://www.w3.org/Protocols/rfc2616/rfc2616.html">RFC 2616</A> | [
"Writes",
"the",
"HTTP",
"request",
"headers",
"for",
"HTTP",
"GET",
"method",
"."
] | 7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d | https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/sandbox/sandbox-common/src/main/java/com/twelvemonkeys/net/HttpURLConnection.java#L681-L744 |
62,460 | haraldk/TwelveMonkeys | sandbox/sandbox-common/src/main/java/com/twelvemonkeys/net/HttpURLConnection.java | HttpURLConnection.findEndOfHeader | private static int findEndOfHeader(byte[] pBytes, int pEnd) {
byte[] header = HTTP_HEADER_END.getBytes();
// Normal condition, check all bytes
for (int i = 0; i < pEnd - 4; i++) { // Need 4 bytes to match
if ((pBytes[i] == header[0]) && (pBytes[i + 1] == header[1]) && (pBytes[i + 2... | java | private static int findEndOfHeader(byte[] pBytes, int pEnd) {
byte[] header = HTTP_HEADER_END.getBytes();
// Normal condition, check all bytes
for (int i = 0; i < pEnd - 4; i++) { // Need 4 bytes to match
if ((pBytes[i] == header[0]) && (pBytes[i + 1] == header[1]) && (pBytes[i + 2... | [
"private",
"static",
"int",
"findEndOfHeader",
"(",
"byte",
"[",
"]",
"pBytes",
",",
"int",
"pEnd",
")",
"{",
"byte",
"[",
"]",
"header",
"=",
"HTTP_HEADER_END",
".",
"getBytes",
"(",
")",
";",
"// Normal condition, check all bytes",
"for",
"(",
"int",
"i",
... | Finds the end of the HTTP response header in an array of bytes.
@todo This one's a little dirty... | [
"Finds",
"the",
"end",
"of",
"the",
"HTTP",
"response",
"header",
"in",
"an",
"array",
"of",
"bytes",
"."
] | 7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d | https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/sandbox/sandbox-common/src/main/java/com/twelvemonkeys/net/HttpURLConnection.java#L751-L780 |
62,461 | haraldk/TwelveMonkeys | sandbox/sandbox-common/src/main/java/com/twelvemonkeys/net/HttpURLConnection.java | HttpURLConnection.detatchResponseHeader | private static InputStream detatchResponseHeader(BufferedInputStream pIS) throws IOException {
// Store header in byte array
ByteArrayOutputStream bytes = new ByteArrayOutputStream();
pIS.mark(BUF_SIZE);
byte[] buffer = new byte[BUF_SIZE];
int length;
int headerEnd;
... | java | private static InputStream detatchResponseHeader(BufferedInputStream pIS) throws IOException {
// Store header in byte array
ByteArrayOutputStream bytes = new ByteArrayOutputStream();
pIS.mark(BUF_SIZE);
byte[] buffer = new byte[BUF_SIZE];
int length;
int headerEnd;
... | [
"private",
"static",
"InputStream",
"detatchResponseHeader",
"(",
"BufferedInputStream",
"pIS",
")",
"throws",
"IOException",
"{",
"// Store header in byte array",
"ByteArrayOutputStream",
"bytes",
"=",
"new",
"ByteArrayOutputStream",
"(",
")",
";",
"pIS",
".",
"mark",
... | Reads the header part of the response, and copies it to a different
InputStream. | [
"Reads",
"the",
"header",
"part",
"of",
"the",
"response",
"and",
"copies",
"it",
"to",
"a",
"different",
"InputStream",
"."
] | 7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d | https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/sandbox/sandbox-common/src/main/java/com/twelvemonkeys/net/HttpURLConnection.java#L786-L833 |
62,462 | haraldk/TwelveMonkeys | sandbox/sandbox-common/src/main/java/com/twelvemonkeys/net/HttpURLConnection.java | HttpURLConnection.parseHeaderFields | private static Properties parseHeaderFields(String[] pHeaders) {
Properties headers = new Properties();
// Get header information
int split;
String field;
String value;
for (String header : pHeaders) {
//System.err.println(pHeaders[i]);
if ((spli... | java | private static Properties parseHeaderFields(String[] pHeaders) {
Properties headers = new Properties();
// Get header information
int split;
String field;
String value;
for (String header : pHeaders) {
//System.err.println(pHeaders[i]);
if ((spli... | [
"private",
"static",
"Properties",
"parseHeaderFields",
"(",
"String",
"[",
"]",
"pHeaders",
")",
"{",
"Properties",
"headers",
"=",
"new",
"Properties",
"(",
")",
";",
"// Get header information",
"int",
"split",
";",
"String",
"field",
";",
"String",
"value",
... | Pareses the response header fields. | [
"Pareses",
"the",
"response",
"header",
"fields",
"."
] | 7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d | https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/sandbox/sandbox-common/src/main/java/com/twelvemonkeys/net/HttpURLConnection.java#L838-L859 |
62,463 | haraldk/TwelveMonkeys | sandbox/sandbox-common/src/main/java/com/twelvemonkeys/net/HttpURLConnection.java | HttpURLConnection.parseResponseHeader | private static String[] parseResponseHeader(InputStream pIS) throws IOException {
List<String> headers = new ArrayList<String>();
// Wrap Stream in Reader
BufferedReader in = new BufferedReader(new InputStreamReader(pIS));
// Get response status
String header;
while ((... | java | private static String[] parseResponseHeader(InputStream pIS) throws IOException {
List<String> headers = new ArrayList<String>();
// Wrap Stream in Reader
BufferedReader in = new BufferedReader(new InputStreamReader(pIS));
// Get response status
String header;
while ((... | [
"private",
"static",
"String",
"[",
"]",
"parseResponseHeader",
"(",
"InputStream",
"pIS",
")",
"throws",
"IOException",
"{",
"List",
"<",
"String",
">",
"headers",
"=",
"new",
"ArrayList",
"<",
"String",
">",
"(",
")",
";",
"// Wrap Stream in Reader",
"Buffer... | Parses the response headers. | [
"Parses",
"the",
"response",
"headers",
"."
] | 7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d | https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/sandbox/sandbox-common/src/main/java/com/twelvemonkeys/net/HttpURLConnection.java#L864-L878 |
62,464 | haraldk/TwelveMonkeys | common/common-image/src/main/java/com/twelvemonkeys/image/GrayFilter.java | GrayFilter.filterRGB | public int filterRGB(int pX, int pY, int pARGB) {
// Get color components
int r = pARGB >> 16 & 0xFF;
int g = pARGB >> 8 & 0xFF;
int b = pARGB & 0xFF;
// ITU standard: Gray scale=(222*Red+707*Green+71*Blue)/1000
int gray = (222 * r + 707 * g + 71 * b) / 10... | java | public int filterRGB(int pX, int pY, int pARGB) {
// Get color components
int r = pARGB >> 16 & 0xFF;
int g = pARGB >> 8 & 0xFF;
int b = pARGB & 0xFF;
// ITU standard: Gray scale=(222*Red+707*Green+71*Blue)/1000
int gray = (222 * r + 707 * g + 71 * b) / 10... | [
"public",
"int",
"filterRGB",
"(",
"int",
"pX",
",",
"int",
"pY",
",",
"int",
"pARGB",
")",
"{",
"// Get color components\r",
"int",
"r",
"=",
"pARGB",
">>",
"16",
"&",
"0xFF",
";",
"int",
"g",
"=",
"pARGB",
">>",
"8",
"&",
"0xFF",
";",
"int",
"b",... | Filters one pixel using ITU color-conversion.
@param pX x
@param pY y
@param pARGB pixel value in default color space
@return the filtered pixel value in the default color space | [
"Filters",
"one",
"pixel",
"using",
"ITU",
"color",
"-",
"conversion",
"."
] | 7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d | https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/common/common-image/src/main/java/com/twelvemonkeys/image/GrayFilter.java#L112-L130 |
62,465 | haraldk/TwelveMonkeys | imageio/imageio-bmp/src/main/java/com/twelvemonkeys/imageio/plugins/bmp/AbstractRLEDecoder.java | AbstractRLEDecoder.decode | public final int decode(final InputStream stream, final ByteBuffer buffer) throws IOException {
// TODO: Allow decoding < row.length at a time and get rid of this assertion...
if (buffer.capacity() < row.length) {
throw new AssertionError("This decoder needs a buffer.capacity() of at least o... | java | public final int decode(final InputStream stream, final ByteBuffer buffer) throws IOException {
// TODO: Allow decoding < row.length at a time and get rid of this assertion...
if (buffer.capacity() < row.length) {
throw new AssertionError("This decoder needs a buffer.capacity() of at least o... | [
"public",
"final",
"int",
"decode",
"(",
"final",
"InputStream",
"stream",
",",
"final",
"ByteBuffer",
"buffer",
")",
"throws",
"IOException",
"{",
"// TODO: Allow decoding < row.length at a time and get rid of this assertion...",
"if",
"(",
"buffer",
".",
"capacity",
"("... | Decodes as much data as possible, from the stream into the buffer.
@param stream the input stream containing RLE data
@param buffer the buffer to decode the data to
@return the number of bytes decoded from the stream, to the buffer
@throws IOException if an I/O related exception occurs while reading | [
"Decodes",
"as",
"much",
"data",
"as",
"possible",
"from",
"the",
"stream",
"into",
"the",
"buffer",
"."
] | 7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d | https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/imageio/imageio-bmp/src/main/java/com/twelvemonkeys/imageio/plugins/bmp/AbstractRLEDecoder.java#L93-L125 |
62,466 | haraldk/TwelveMonkeys | servlet/src/main/java/com/twelvemonkeys/servlet/fileupload/FileUploadFilter.java | FileUploadFilter.init | public void init() throws ServletException {
// Get the name of the upload directory.
String uploadDirParam = getInitParameter("uploadDir");
if (!StringUtil.isEmpty(uploadDirParam)) {
try {
URL uploadDirURL = getServletContext().getResource(uploadDirParam);
... | java | public void init() throws ServletException {
// Get the name of the upload directory.
String uploadDirParam = getInitParameter("uploadDir");
if (!StringUtil.isEmpty(uploadDirParam)) {
try {
URL uploadDirURL = getServletContext().getResource(uploadDirParam);
... | [
"public",
"void",
"init",
"(",
")",
"throws",
"ServletException",
"{",
"// Get the name of the upload directory.\r",
"String",
"uploadDirParam",
"=",
"getInitParameter",
"(",
"\"uploadDir\"",
")",
";",
"if",
"(",
"!",
"StringUtil",
".",
"isEmpty",
"(",
"uploadDirParam... | This method is called by the server before the filter goes into service,
and here it determines the file upload directory.
@throws ServletException | [
"This",
"method",
"is",
"called",
"by",
"the",
"server",
"before",
"the",
"filter",
"goes",
"into",
"service",
"and",
"here",
"it",
"determines",
"the",
"file",
"upload",
"directory",
"."
] | 7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d | https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/servlet/src/main/java/com/twelvemonkeys/servlet/fileupload/FileUploadFilter.java#L68-L85 |
62,467 | haraldk/TwelveMonkeys | common/common-io/src/main/java/com/twelvemonkeys/io/FileUtil.java | FileUtil.copyDir | private static boolean copyDir(File pFrom, File pTo, boolean pOverWrite) throws IOException {
if (pTo.exists() && !pTo.isDirectory()) {
throw new IOException("A directory may only be copied to another directory, not to a file");
}
pTo.mkdirs(); // mkdir?
boolean allOkay... | java | private static boolean copyDir(File pFrom, File pTo, boolean pOverWrite) throws IOException {
if (pTo.exists() && !pTo.isDirectory()) {
throw new IOException("A directory may only be copied to another directory, not to a file");
}
pTo.mkdirs(); // mkdir?
boolean allOkay... | [
"private",
"static",
"boolean",
"copyDir",
"(",
"File",
"pFrom",
",",
"File",
"pTo",
",",
"boolean",
"pOverWrite",
")",
"throws",
"IOException",
"{",
"if",
"(",
"pTo",
".",
"exists",
"(",
")",
"&&",
"!",
"pTo",
".",
"isDirectory",
"(",
")",
")",
"{",
... | Copies a directory recursively. If the destination folder does not exist,
it is created
@param pFrom the source directory
@param pTo the destination directory
@param pOverWrite {@code true} if we should allow overwrting existing files
@return {@code true} if all files were copied sucessfully
@throws IOException if {@c... | [
"Copies",
"a",
"directory",
"recursively",
".",
"If",
"the",
"destination",
"folder",
"does",
"not",
"exist",
"it",
"is",
"created"
] | 7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d | https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/common/common-io/src/main/java/com/twelvemonkeys/io/FileUtil.java#L282-L296 |
62,468 | haraldk/TwelveMonkeys | common/common-io/src/main/java/com/twelvemonkeys/io/FileUtil.java | FileUtil.copy | public static boolean copy(InputStream pFrom, OutputStream pTo) throws IOException {
Validate.notNull(pFrom, "from");
Validate.notNull(pTo, "to");
// TODO: Consider using file channels for faster copy where possible
// Use buffer size two times byte array, to avoid i/o bottleneck... | java | public static boolean copy(InputStream pFrom, OutputStream pTo) throws IOException {
Validate.notNull(pFrom, "from");
Validate.notNull(pTo, "to");
// TODO: Consider using file channels for faster copy where possible
// Use buffer size two times byte array, to avoid i/o bottleneck... | [
"public",
"static",
"boolean",
"copy",
"(",
"InputStream",
"pFrom",
",",
"OutputStream",
"pTo",
")",
"throws",
"IOException",
"{",
"Validate",
".",
"notNull",
"(",
"pFrom",
",",
"\"from\"",
")",
";",
"Validate",
".",
"notNull",
"(",
"pTo",
",",
"\"to\"",
"... | Copies all data from one stream to another.
The data is copied from the fromStream to the toStream using buffered
streams for efficiency.
@param pFrom The input srteam to copy from
@param pTo The output stream to copy to
@return true. Otherwise, an
IOException is thrown, and the method does not return a value.
@thro... | [
"Copies",
"all",
"data",
"from",
"one",
"stream",
"to",
"another",
".",
"The",
"data",
"is",
"copied",
"from",
"the",
"fromStream",
"to",
"the",
"toStream",
"using",
"buffered",
"streams",
"for",
"efficiency",
"."
] | 7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d | https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/common/common-io/src/main/java/com/twelvemonkeys/io/FileUtil.java#L311-L333 |
62,469 | haraldk/TwelveMonkeys | common/common-io/src/main/java/com/twelvemonkeys/io/FileUtil.java | FileUtil.getDirectoryname | public static String getDirectoryname(final String pPath, final char pSeparator) {
int index = pPath.lastIndexOf(pSeparator);
if (index < 0) {
return ""; // Assume only filename
}
return pPath.substring(0, index);
} | java | public static String getDirectoryname(final String pPath, final char pSeparator) {
int index = pPath.lastIndexOf(pSeparator);
if (index < 0) {
return ""; // Assume only filename
}
return pPath.substring(0, index);
} | [
"public",
"static",
"String",
"getDirectoryname",
"(",
"final",
"String",
"pPath",
",",
"final",
"char",
"pSeparator",
")",
"{",
"int",
"index",
"=",
"pPath",
".",
"lastIndexOf",
"(",
"pSeparator",
")",
";",
"if",
"(",
"index",
"<",
"0",
")",
"{",
"retur... | Extracts the directory path without the filename, from a complete
filename path.
@param pPath The full filename path.
@param pSeparator the separator char used in {@code pPath}
@return the path without the filename.
@see File#getParent
@see #getFilename | [
"Extracts",
"the",
"directory",
"path",
"without",
"the",
"filename",
"from",
"a",
"complete",
"filename",
"path",
"."
] | 7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d | https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/common/common-io/src/main/java/com/twelvemonkeys/io/FileUtil.java#L436-L443 |
62,470 | haraldk/TwelveMonkeys | common/common-io/src/main/java/com/twelvemonkeys/io/FileUtil.java | FileUtil.getFilename | public static String getFilename(final String pPath, final char pSeparator) {
int index = pPath.lastIndexOf(pSeparator);
if (index < 0) {
return pPath; // Assume only filename
}
return pPath.substring(index + 1);
} | java | public static String getFilename(final String pPath, final char pSeparator) {
int index = pPath.lastIndexOf(pSeparator);
if (index < 0) {
return pPath; // Assume only filename
}
return pPath.substring(index + 1);
} | [
"public",
"static",
"String",
"getFilename",
"(",
"final",
"String",
"pPath",
",",
"final",
"char",
"pSeparator",
")",
"{",
"int",
"index",
"=",
"pPath",
".",
"lastIndexOf",
"(",
"pSeparator",
")",
";",
"if",
"(",
"index",
"<",
"0",
")",
"{",
"return",
... | Extracts the filename of a complete filename path.
@param pPath The full filename path.
@param pSeparator The file separator.
@return the extracted filename.
@see File#getName
@see #getDirectoryname | [
"Extracts",
"the",
"filename",
"of",
"a",
"complete",
"filename",
"path",
"."
] | 7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d | https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/common/common-io/src/main/java/com/twelvemonkeys/io/FileUtil.java#L466-L474 |
62,471 | haraldk/TwelveMonkeys | common/common-io/src/main/java/com/twelvemonkeys/io/FileUtil.java | FileUtil.isEmpty | public static boolean isEmpty(File pFile) {
if (pFile.isDirectory()) {
return (pFile.list().length == 0);
}
return (pFile.length() == 0);
} | java | public static boolean isEmpty(File pFile) {
if (pFile.isDirectory()) {
return (pFile.list().length == 0);
}
return (pFile.length() == 0);
} | [
"public",
"static",
"boolean",
"isEmpty",
"(",
"File",
"pFile",
")",
"{",
"if",
"(",
"pFile",
".",
"isDirectory",
"(",
")",
")",
"{",
"return",
"(",
"pFile",
".",
"list",
"(",
")",
".",
"length",
"==",
"0",
")",
";",
"}",
"return",
"(",
"pFile",
... | Tests if a file or directory has no content.
A file is empty if it has a length of 0L. A non-existing file is also
considered empty.
A directory is considered empty if it contains no files.
@param pFile The file to test
@return {@code true} if the file is empty, otherwise
{@code false}. | [
"Tests",
"if",
"a",
"file",
"or",
"directory",
"has",
"no",
"content",
".",
"A",
"file",
"is",
"empty",
"if",
"it",
"has",
"a",
"length",
"of",
"0L",
".",
"A",
"non",
"-",
"existing",
"file",
"is",
"also",
"considered",
"empty",
".",
"A",
"directory"... | 7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d | https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/common/common-io/src/main/java/com/twelvemonkeys/io/FileUtil.java#L487-L492 |
62,472 | haraldk/TwelveMonkeys | common/common-io/src/main/java/com/twelvemonkeys/io/FileUtil.java | FileUtil.getTempDir | public static String getTempDir() {
synchronized (FileUtil.class) {
if (TEMP_DIR == null) {
// Get the 'java.io.tmpdir' property
String tmpDir = System.getProperty("java.io.tmpdir");
if (StringUtil.isEmpty(tmpDir)) {
// Stup... | java | public static String getTempDir() {
synchronized (FileUtil.class) {
if (TEMP_DIR == null) {
// Get the 'java.io.tmpdir' property
String tmpDir = System.getProperty("java.io.tmpdir");
if (StringUtil.isEmpty(tmpDir)) {
// Stup... | [
"public",
"static",
"String",
"getTempDir",
"(",
")",
"{",
"synchronized",
"(",
"FileUtil",
".",
"class",
")",
"{",
"if",
"(",
"TEMP_DIR",
"==",
"null",
")",
"{",
"// Get the 'java.io.tmpdir' property\r",
"String",
"tmpDir",
"=",
"System",
".",
"getProperty",
... | Gets the default temp directory for the system.
@return a {@code String}, representing the path to the default temp
directory.
@see File#createTempFile | [
"Gets",
"the",
"default",
"temp",
"directory",
"for",
"the",
"system",
"."
] | 7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d | https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/common/common-io/src/main/java/com/twelvemonkeys/io/FileUtil.java#L511-L531 |
62,473 | haraldk/TwelveMonkeys | common/common-io/src/main/java/com/twelvemonkeys/io/FileUtil.java | FileUtil.read | public static byte[] read(File pFile) throws IOException {
// Custom implementation, as we know the size of a file
if (!pFile.exists()) {
throw new FileNotFoundException(pFile.toString());
}
byte[] bytes = new byte[(int) pFile.length()];
InputStream in = null;... | java | public static byte[] read(File pFile) throws IOException {
// Custom implementation, as we know the size of a file
if (!pFile.exists()) {
throw new FileNotFoundException(pFile.toString());
}
byte[] bytes = new byte[(int) pFile.length()];
InputStream in = null;... | [
"public",
"static",
"byte",
"[",
"]",
"read",
"(",
"File",
"pFile",
")",
"throws",
"IOException",
"{",
"// Custom implementation, as we know the size of a file\r",
"if",
"(",
"!",
"pFile",
".",
"exists",
"(",
")",
")",
"{",
"throw",
"new",
"FileNotFoundException",... | Gets the contents of the given file, as a byte array.
@param pFile the file to get content from
@return the content of the file as a byte array.
@throws IOException if the read operation fails | [
"Gets",
"the",
"contents",
"of",
"the",
"given",
"file",
"as",
"a",
"byte",
"array",
"."
] | 7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d | https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/common/common-io/src/main/java/com/twelvemonkeys/io/FileUtil.java#L551-L577 |
62,474 | haraldk/TwelveMonkeys | common/common-io/src/main/java/com/twelvemonkeys/io/FileUtil.java | FileUtil.read | public static byte[] read(InputStream pInput) throws IOException {
// Create byte array
ByteArrayOutputStream bytes = new FastByteArrayOutputStream(BUF_SIZE);
// Copy from stream to byte array
copy(pInput, bytes);
return bytes.toByteArray();
} | java | public static byte[] read(InputStream pInput) throws IOException {
// Create byte array
ByteArrayOutputStream bytes = new FastByteArrayOutputStream(BUF_SIZE);
// Copy from stream to byte array
copy(pInput, bytes);
return bytes.toByteArray();
} | [
"public",
"static",
"byte",
"[",
"]",
"read",
"(",
"InputStream",
"pInput",
")",
"throws",
"IOException",
"{",
"// Create byte array\r",
"ByteArrayOutputStream",
"bytes",
"=",
"new",
"FastByteArrayOutputStream",
"(",
"BUF_SIZE",
")",
";",
"// Copy from stream to byte ar... | Reads all data from the input stream to a byte array.
@param pInput The input stream to read from
@return The content of the stream as a byte array.
@throws IOException if an i/o error occurs during read. | [
"Reads",
"all",
"data",
"from",
"the",
"input",
"stream",
"to",
"a",
"byte",
"array",
"."
] | 7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d | https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/common/common-io/src/main/java/com/twelvemonkeys/io/FileUtil.java#L586-L594 |
62,475 | haraldk/TwelveMonkeys | common/common-io/src/main/java/com/twelvemonkeys/io/FileUtil.java | FileUtil.write | public static boolean write(File pFile, byte[] pData) throws IOException {
boolean success = false;
OutputStream out = null;
try {
out = new BufferedOutputStream(new FileOutputStream(pFile));
success = write(out, pData);
}
finally {
c... | java | public static boolean write(File pFile, byte[] pData) throws IOException {
boolean success = false;
OutputStream out = null;
try {
out = new BufferedOutputStream(new FileOutputStream(pFile));
success = write(out, pData);
}
finally {
c... | [
"public",
"static",
"boolean",
"write",
"(",
"File",
"pFile",
",",
"byte",
"[",
"]",
"pData",
")",
"throws",
"IOException",
"{",
"boolean",
"success",
"=",
"false",
";",
"OutputStream",
"out",
"=",
"null",
";",
"try",
"{",
"out",
"=",
"new",
"BufferedOut... | Writes the contents from a byte array to a file.
@param pFile The file to write to
@param pData The byte array to write
@return {@code true}, otherwise an IOException is thrown.
@throws IOException if an i/o error occurs during write. | [
"Writes",
"the",
"contents",
"from",
"a",
"byte",
"array",
"to",
"a",
"file",
"."
] | 7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d | https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/common/common-io/src/main/java/com/twelvemonkeys/io/FileUtil.java#L620-L632 |
62,476 | haraldk/TwelveMonkeys | common/common-io/src/main/java/com/twelvemonkeys/io/FileUtil.java | FileUtil.delete | public static boolean delete(final File pFile, final boolean pForce) throws IOException {
if (pForce && pFile.isDirectory()) {
return deleteDir(pFile);
}
return pFile.exists() && pFile.delete();
} | java | public static boolean delete(final File pFile, final boolean pForce) throws IOException {
if (pForce && pFile.isDirectory()) {
return deleteDir(pFile);
}
return pFile.exists() && pFile.delete();
} | [
"public",
"static",
"boolean",
"delete",
"(",
"final",
"File",
"pFile",
",",
"final",
"boolean",
"pForce",
")",
"throws",
"IOException",
"{",
"if",
"(",
"pForce",
"&&",
"pFile",
".",
"isDirectory",
"(",
")",
")",
"{",
"return",
"deleteDir",
"(",
"pFile",
... | Deletes the specified file.
@param pFile The file to delete
@param pForce Forces delete, even if the parameter is a directory, and
is not empty. Be careful!
@return {@code true}, if the file existed and was deleted.
@throws IOException if an i/o error occurs during delete. | [
"Deletes",
"the",
"specified",
"file",
"."
] | 7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d | https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/common/common-io/src/main/java/com/twelvemonkeys/io/FileUtil.java#L655-L660 |
62,477 | haraldk/TwelveMonkeys | imageio/imageio-core/src/main/java/com/twelvemonkeys/imageio/color/KCMSSanitizerStrategy.java | KCMSSanitizerStrategy.fixProfileXYZTag | private static boolean fixProfileXYZTag(final ICC_Profile profile, final int tagSignature) {
byte[] data = profile.getData(tagSignature);
// The CMM expects 0x64 65 73 63 ('XYZ ') but is 0x17 A5 05 B8..?
if (data != null && intFromBigEndian(data, 0) == CORBIS_RGB_ALTERNATE_XYZ) {
in... | java | private static boolean fixProfileXYZTag(final ICC_Profile profile, final int tagSignature) {
byte[] data = profile.getData(tagSignature);
// The CMM expects 0x64 65 73 63 ('XYZ ') but is 0x17 A5 05 B8..?
if (data != null && intFromBigEndian(data, 0) == CORBIS_RGB_ALTERNATE_XYZ) {
in... | [
"private",
"static",
"boolean",
"fixProfileXYZTag",
"(",
"final",
"ICC_Profile",
"profile",
",",
"final",
"int",
"tagSignature",
")",
"{",
"byte",
"[",
"]",
"data",
"=",
"profile",
".",
"getData",
"(",
"tagSignature",
")",
";",
"// The CMM expects 0x64 65 73 63 ('... | Fixes problematic 'XYZ ' tags in Corbis RGB profile.
@return {@code true} if found and fixed, otherwise {@code false} for short-circuiting
to avoid unnecessary array copying. | [
"Fixes",
"problematic",
"XYZ",
"tags",
"in",
"Corbis",
"RGB",
"profile",
"."
] | 7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d | https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/imageio/imageio-core/src/main/java/com/twelvemonkeys/imageio/color/KCMSSanitizerStrategy.java#L81-L93 |
62,478 | haraldk/TwelveMonkeys | imageio/imageio-core/src/main/java/com/twelvemonkeys/imageio/color/YCbCrConverter.java | YCbCrConverter.buildYCCtoRGBtable | private static void buildYCCtoRGBtable() {
if (ColorSpaces.DEBUG) {
System.err.println("Building YCC conversion table");
}
for (int i = 0, x = -CENTERJSAMPLE; i <= MAXJSAMPLE; i++, x++) {
// i is the actual input pixel value, in the range 0..MAXJSAMPLE
// The... | java | private static void buildYCCtoRGBtable() {
if (ColorSpaces.DEBUG) {
System.err.println("Building YCC conversion table");
}
for (int i = 0, x = -CENTERJSAMPLE; i <= MAXJSAMPLE; i++, x++) {
// i is the actual input pixel value, in the range 0..MAXJSAMPLE
// The... | [
"private",
"static",
"void",
"buildYCCtoRGBtable",
"(",
")",
"{",
"if",
"(",
"ColorSpaces",
".",
"DEBUG",
")",
"{",
"System",
".",
"err",
".",
"println",
"(",
"\"Building YCC conversion table\"",
")",
";",
"}",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"x",... | Initializes tables for YCC->RGB color space conversion. | [
"Initializes",
"tables",
"for",
"YCC",
"-",
">",
"RGB",
"color",
"space",
"conversion",
"."
] | 7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d | https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/imageio/imageio-core/src/main/java/com/twelvemonkeys/imageio/color/YCbCrConverter.java#L56-L74 |
62,479 | haraldk/TwelveMonkeys | sandbox/sandbox-servlet/src/main/java/com/twelvemonkeys/servlet/jsp/droplet/taglib/OparamTag.java | OparamTag.getOparamCountFromRequest | private int getOparamCountFromRequest(HttpServletRequest pRequest) {
// Use request.attribute for incrementing oparam counter
Integer count = (Integer) pRequest.getAttribute(COUNTER);
if (count == null) {
count = new Integer(0);
}
else {
count = new... | java | private int getOparamCountFromRequest(HttpServletRequest pRequest) {
// Use request.attribute for incrementing oparam counter
Integer count = (Integer) pRequest.getAttribute(COUNTER);
if (count == null) {
count = new Integer(0);
}
else {
count = new... | [
"private",
"int",
"getOparamCountFromRequest",
"(",
"HttpServletRequest",
"pRequest",
")",
"{",
"// Use request.attribute for incrementing oparam counter\r",
"Integer",
"count",
"=",
"(",
"Integer",
")",
"pRequest",
".",
"getAttribute",
"(",
"COUNTER",
")",
";",
"if",
"... | Gets the current oparam count for this request | [
"Gets",
"the",
"current",
"oparam",
"count",
"for",
"this",
"request"
] | 7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d | https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/sandbox/sandbox-servlet/src/main/java/com/twelvemonkeys/servlet/jsp/droplet/taglib/OparamTag.java#L205-L219 |
62,480 | haraldk/TwelveMonkeys | common/common-image/src/main/java/com/twelvemonkeys/image/ResampleOp.java | ResampleOp.getFilterType | private static int getFilterType(RenderingHints pHints) {
if (pHints == null) {
return FILTER_UNDEFINED;
}
if (pHints.containsKey(KEY_RESAMPLE_INTERPOLATION)) {
Object value = pHints.get(KEY_RESAMPLE_INTERPOLATION);
// NOTE: Workaround for a bug in Ren... | java | private static int getFilterType(RenderingHints pHints) {
if (pHints == null) {
return FILTER_UNDEFINED;
}
if (pHints.containsKey(KEY_RESAMPLE_INTERPOLATION)) {
Object value = pHints.get(KEY_RESAMPLE_INTERPOLATION);
// NOTE: Workaround for a bug in Ren... | [
"private",
"static",
"int",
"getFilterType",
"(",
"RenderingHints",
"pHints",
")",
"{",
"if",
"(",
"pHints",
"==",
"null",
")",
"{",
"return",
"FILTER_UNDEFINED",
";",
"}",
"if",
"(",
"pHints",
".",
"containsKey",
"(",
"KEY_RESAMPLE_INTERPOLATION",
")",
")",
... | Gets the filter type specified by the given hints.
@param pHints rendering hints
@return a filter type constant | [
"Gets",
"the",
"filter",
"type",
"specified",
"by",
"the",
"given",
"hints",
"."
] | 7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d | https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/common/common-image/src/main/java/com/twelvemonkeys/image/ResampleOp.java#L456-L491 |
62,481 | haraldk/TwelveMonkeys | sandbox/sandbox-common/src/main/java/com/twelvemonkeys/sql/ObjectMapper.java | ObjectMapper.getColumn | public String getColumn(String pProperty) {
if (mPropertiesMap == null || pProperty == null)
return null;
return (String) mPropertiesMap.get(pProperty);
} | java | public String getColumn(String pProperty) {
if (mPropertiesMap == null || pProperty == null)
return null;
return (String) mPropertiesMap.get(pProperty);
} | [
"public",
"String",
"getColumn",
"(",
"String",
"pProperty",
")",
"{",
"if",
"(",
"mPropertiesMap",
"==",
"null",
"||",
"pProperty",
"==",
"null",
")",
"return",
"null",
";",
"return",
"(",
"String",
")",
"mPropertiesMap",
".",
"get",
"(",
"pProperty",
")"... | Gets the column for a given property.
@param property The property
@return The name of the matching database column, on the form
table.column | [
"Gets",
"the",
"column",
"for",
"a",
"given",
"property",
"."
] | 7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d | https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/sandbox/sandbox-common/src/main/java/com/twelvemonkeys/sql/ObjectMapper.java#L264-L268 |
62,482 | haraldk/TwelveMonkeys | sandbox/sandbox-common/src/main/java/com/twelvemonkeys/sql/ObjectMapper.java | ObjectMapper.getTable | public String getTable(String pProperty) {
String table = getColumn(pProperty);
if (table != null) {
int dotIdx = 0;
if ((dotIdx = table.lastIndexOf(".")) >= 0)
table = table.substring(0, dotIdx);
else
return null;
}
... | java | public String getTable(String pProperty) {
String table = getColumn(pProperty);
if (table != null) {
int dotIdx = 0;
if ((dotIdx = table.lastIndexOf(".")) >= 0)
table = table.substring(0, dotIdx);
else
return null;
}
... | [
"public",
"String",
"getTable",
"(",
"String",
"pProperty",
")",
"{",
"String",
"table",
"=",
"getColumn",
"(",
"pProperty",
")",
";",
"if",
"(",
"table",
"!=",
"null",
")",
"{",
"int",
"dotIdx",
"=",
"0",
";",
"if",
"(",
"(",
"dotIdx",
"=",
"table",... | Gets the table name for a given property.
@param property The property
@return The name of the matching database table. | [
"Gets",
"the",
"table",
"name",
"for",
"a",
"given",
"property",
"."
] | 7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d | https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/sandbox/sandbox-common/src/main/java/com/twelvemonkeys/sql/ObjectMapper.java#L277-L289 |
62,483 | haraldk/TwelveMonkeys | sandbox/sandbox-common/src/main/java/com/twelvemonkeys/sql/ObjectMapper.java | ObjectMapper.getProperty | public String getProperty(String pColumn) {
if (mColumnMap == null || pColumn == null)
return null;
String property = (String) mColumnMap.get(pColumn);
int dotIdx = 0;
if (property == null && (dotIdx = pColumn.lastIndexOf(".")) >= 0)
property = (String) ... | java | public String getProperty(String pColumn) {
if (mColumnMap == null || pColumn == null)
return null;
String property = (String) mColumnMap.get(pColumn);
int dotIdx = 0;
if (property == null && (dotIdx = pColumn.lastIndexOf(".")) >= 0)
property = (String) ... | [
"public",
"String",
"getProperty",
"(",
"String",
"pColumn",
")",
"{",
"if",
"(",
"mColumnMap",
"==",
"null",
"||",
"pColumn",
"==",
"null",
")",
"return",
"null",
";",
"String",
"property",
"=",
"(",
"String",
")",
"mColumnMap",
".",
"get",
"(",
"pColum... | Gets the property for a given database column. If the column incudes
table qualifier, the table qualifier is removed.
@param column The name of the column
@return The name of the mathcing property | [
"Gets",
"the",
"property",
"for",
"a",
"given",
"database",
"column",
".",
"If",
"the",
"column",
"incudes",
"table",
"qualifier",
"the",
"table",
"qualifier",
"is",
"removed",
"."
] | 7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d | https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/sandbox/sandbox-common/src/main/java/com/twelvemonkeys/sql/ObjectMapper.java#L299-L310 |
62,484 | haraldk/TwelveMonkeys | sandbox/sandbox-common/src/main/java/com/twelvemonkeys/sql/ObjectMapper.java | ObjectMapper.mapObjects | public synchronized Object[] mapObjects(ResultSet pRSet) throws SQLException {
Vector result = new Vector();
ResultSetMetaData meta = pRSet.getMetaData();
int cols = meta.getColumnCount();
// Get colum names
String[] colNames = new String[cols];
for (int i = 0; ... | java | public synchronized Object[] mapObjects(ResultSet pRSet) throws SQLException {
Vector result = new Vector();
ResultSetMetaData meta = pRSet.getMetaData();
int cols = meta.getColumnCount();
// Get colum names
String[] colNames = new String[cols];
for (int i = 0; ... | [
"public",
"synchronized",
"Object",
"[",
"]",
"mapObjects",
"(",
"ResultSet",
"pRSet",
")",
"throws",
"SQLException",
"{",
"Vector",
"result",
"=",
"new",
"Vector",
"(",
")",
";",
"ResultSetMetaData",
"meta",
"=",
"pRSet",
".",
"getMetaData",
"(",
")",
";",
... | Maps each row of the given result set to an object ot this OM's type.
@param rs The ResultSet to process (map to objects)
@return An array of objects (of this OM's class). If there are no rows
in the ResultSet, an empty (zero-length) array will be returned. | [
"Maps",
"each",
"row",
"of",
"the",
"given",
"result",
"set",
"to",
"an",
"object",
"ot",
"this",
"OM",
"s",
"type",
"."
] | 7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d | https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/sandbox/sandbox-common/src/main/java/com/twelvemonkeys/sql/ObjectMapper.java#L321-L377 |
62,485 | haraldk/TwelveMonkeys | sandbox/sandbox-common/src/main/java/com/twelvemonkeys/sql/ObjectMapper.java | ObjectMapper.buildIdentitySQL | String buildIdentitySQL(String[] pKeys) {
mTables = new Hashtable();
mColumns = new Vector();
// Get columns to select
mColumns.addElement(getPrimaryKey());
// Get tables to select (and join) from and their joins
tableJoins(null, false);
for (int i =... | java | String buildIdentitySQL(String[] pKeys) {
mTables = new Hashtable();
mColumns = new Vector();
// Get columns to select
mColumns.addElement(getPrimaryKey());
// Get tables to select (and join) from and their joins
tableJoins(null, false);
for (int i =... | [
"String",
"buildIdentitySQL",
"(",
"String",
"[",
"]",
"pKeys",
")",
"{",
"mTables",
"=",
"new",
"Hashtable",
"(",
")",
";",
"mColumns",
"=",
"new",
"Vector",
"(",
")",
";",
"// Get columns to select\r",
"mColumns",
".",
"addElement",
"(",
"getPrimaryKey",
"... | Creates a SQL query string to get the primary keys for this
ObjectMapper. | [
"Creates",
"a",
"SQL",
"query",
"string",
"to",
"get",
"the",
"primary",
"keys",
"for",
"this",
"ObjectMapper",
"."
] | 7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d | https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/sandbox/sandbox-common/src/main/java/com/twelvemonkeys/sql/ObjectMapper.java#L462-L479 |
62,486 | haraldk/TwelveMonkeys | sandbox/sandbox-common/src/main/java/com/twelvemonkeys/sql/ObjectMapper.java | ObjectMapper.buildSQL | public String buildSQL() {
mTables = new Hashtable();
mColumns = new Vector();
String key = null;
for (Enumeration keys = mPropertiesMap.keys(); keys.hasMoreElements();) {
key = (String) keys.nextElement();
// Get columns to select
Strin... | java | public String buildSQL() {
mTables = new Hashtable();
mColumns = new Vector();
String key = null;
for (Enumeration keys = mPropertiesMap.keys(); keys.hasMoreElements();) {
key = (String) keys.nextElement();
// Get columns to select
Strin... | [
"public",
"String",
"buildSQL",
"(",
")",
"{",
"mTables",
"=",
"new",
"Hashtable",
"(",
")",
";",
"mColumns",
"=",
"new",
"Vector",
"(",
")",
";",
"String",
"key",
"=",
"null",
";",
"for",
"(",
"Enumeration",
"keys",
"=",
"mPropertiesMap",
".",
"keys",... | Creates a SQL query string to get objects for this ObjectMapper. | [
"Creates",
"a",
"SQL",
"query",
"string",
"to",
"get",
"objects",
"for",
"this",
"ObjectMapper",
"."
] | 7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d | https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/sandbox/sandbox-common/src/main/java/com/twelvemonkeys/sql/ObjectMapper.java#L485-L503 |
62,487 | haraldk/TwelveMonkeys | sandbox/sandbox-common/src/main/java/com/twelvemonkeys/sql/ObjectMapper.java | ObjectMapper.buildSelectClause | private String buildSelectClause() {
StringBuilder sqlBuf = new StringBuilder();
sqlBuf.append("SELECT ");
String column = null;
for (Enumeration select = mColumns.elements(); select.hasMoreElements();) {
column = (String) select.nextElement();
/*
... | java | private String buildSelectClause() {
StringBuilder sqlBuf = new StringBuilder();
sqlBuf.append("SELECT ");
String column = null;
for (Enumeration select = mColumns.elements(); select.hasMoreElements();) {
column = (String) select.nextElement();
/*
... | [
"private",
"String",
"buildSelectClause",
"(",
")",
"{",
"StringBuilder",
"sqlBuf",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"sqlBuf",
".",
"append",
"(",
"\"SELECT \"",
")",
";",
"String",
"column",
"=",
"null",
";",
"for",
"(",
"Enumeration",
"select",
... | Builds a SQL SELECT clause from the columns Vector | [
"Builds",
"a",
"SQL",
"SELECT",
"clause",
"from",
"the",
"columns",
"Vector"
] | 7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d | https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/sandbox/sandbox-common/src/main/java/com/twelvemonkeys/sql/ObjectMapper.java#L509-L533 |
62,488 | haraldk/TwelveMonkeys | sandbox/sandbox-common/src/main/java/com/twelvemonkeys/sql/ObjectMapper.java | ObjectMapper.tableJoins | private void tableJoins(String pColumn, boolean pWhereJoin) {
String join = null;
String table = null;
if (pColumn == null) {
// Identity
join = getIdentityJoin();
table = getTable(getProperty(getPrimaryKey()));
}
else {
... | java | private void tableJoins(String pColumn, boolean pWhereJoin) {
String join = null;
String table = null;
if (pColumn == null) {
// Identity
join = getIdentityJoin();
table = getTable(getProperty(getPrimaryKey()));
}
else {
... | [
"private",
"void",
"tableJoins",
"(",
"String",
"pColumn",
",",
"boolean",
"pWhereJoin",
")",
"{",
"String",
"join",
"=",
"null",
";",
"String",
"table",
"=",
"null",
";",
"if",
"(",
"pColumn",
"==",
"null",
")",
"{",
"// Identity\r",
"join",
"=",
"getId... | Finds tables used in mappings and joins and adds them to the tables
Hashtable, with the table name as key, and the join as value. | [
"Finds",
"tables",
"used",
"in",
"mappings",
"and",
"joins",
"and",
"adds",
"them",
"to",
"the",
"tables",
"Hashtable",
"with",
"the",
"table",
"name",
"as",
"key",
"and",
"the",
"join",
"as",
"value",
"."
] | 7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d | https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/sandbox/sandbox-common/src/main/java/com/twelvemonkeys/sql/ObjectMapper.java#L603-L661 |
62,489 | haraldk/TwelveMonkeys | common/common-io/src/main/java/com/twelvemonkeys/io/SeekableOutputStream.java | SeekableOutputStream.seek | public final void seek(long pPosition) throws IOException {
checkOpen();
// TODO: This is correct according to javax.imageio (IndexOutOfBoundsException),
// but it's inconsistent with reset that throws IOException...
if (pPosition < flushedPosition) {
throw new IndexOu... | java | public final void seek(long pPosition) throws IOException {
checkOpen();
// TODO: This is correct according to javax.imageio (IndexOutOfBoundsException),
// but it's inconsistent with reset that throws IOException...
if (pPosition < flushedPosition) {
throw new IndexOu... | [
"public",
"final",
"void",
"seek",
"(",
"long",
"pPosition",
")",
"throws",
"IOException",
"{",
"checkOpen",
"(",
")",
";",
"// TODO: This is correct according to javax.imageio (IndexOutOfBoundsException),\r",
"// but it's inconsistent with reset that throws IOException...\r",
"if"... | probably a good idea to extract a delegate..? | [
"probably",
"a",
"good",
"idea",
"to",
"extract",
"a",
"delegate",
"..",
"?"
] | 7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d | https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/common/common-io/src/main/java/com/twelvemonkeys/io/SeekableOutputStream.java#L63-L74 |
62,490 | haraldk/TwelveMonkeys | common/common-io/src/main/java/com/twelvemonkeys/net/MIMEUtil.java | MIMEUtil.getMIMEType | public static String getMIMEType(final String pFileExt) {
List<String> types = sExtToMIME.get(StringUtil.toLowerCase(pFileExt));
return (types == null || types.isEmpty()) ? null : types.get(0);
} | java | public static String getMIMEType(final String pFileExt) {
List<String> types = sExtToMIME.get(StringUtil.toLowerCase(pFileExt));
return (types == null || types.isEmpty()) ? null : types.get(0);
} | [
"public",
"static",
"String",
"getMIMEType",
"(",
"final",
"String",
"pFileExt",
")",
"{",
"List",
"<",
"String",
">",
"types",
"=",
"sExtToMIME",
".",
"get",
"(",
"StringUtil",
".",
"toLowerCase",
"(",
"pFileExt",
")",
")",
";",
"return",
"(",
"types",
... | Returns the default MIME type for the given file extension.
@param pFileExt the file extension
@return a {@code String} containing the MIME type, or {@code null} if
there are no known MIME types for the given file extension. | [
"Returns",
"the",
"default",
"MIME",
"type",
"for",
"the",
"given",
"file",
"extension",
"."
] | 7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d | https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/common/common-io/src/main/java/com/twelvemonkeys/net/MIMEUtil.java#L109-L112 |
62,491 | haraldk/TwelveMonkeys | common/common-io/src/main/java/com/twelvemonkeys/net/MIMEUtil.java | MIMEUtil.getMIMETypes | public static List<String> getMIMETypes(final String pFileExt) {
List<String> types = sExtToMIME.get(StringUtil.toLowerCase(pFileExt));
return maskNull(types);
} | java | public static List<String> getMIMETypes(final String pFileExt) {
List<String> types = sExtToMIME.get(StringUtil.toLowerCase(pFileExt));
return maskNull(types);
} | [
"public",
"static",
"List",
"<",
"String",
">",
"getMIMETypes",
"(",
"final",
"String",
"pFileExt",
")",
"{",
"List",
"<",
"String",
">",
"types",
"=",
"sExtToMIME",
".",
"get",
"(",
"StringUtil",
".",
"toLowerCase",
"(",
"pFileExt",
")",
")",
";",
"retu... | Returns all MIME types for the given file extension.
@param pFileExt the file extension
@return a {@link List} of {@code String}s containing the MIME types, or an empty
list, if there are no known MIME types for the given file extension. | [
"Returns",
"all",
"MIME",
"types",
"for",
"the",
"given",
"file",
"extension",
"."
] | 7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d | https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/common/common-io/src/main/java/com/twelvemonkeys/net/MIMEUtil.java#L122-L125 |
62,492 | haraldk/TwelveMonkeys | common/common-io/src/main/java/com/twelvemonkeys/net/MIMEUtil.java | MIMEUtil.getExtensionForWildcard | private static List<String> getExtensionForWildcard(final String pMIME) {
final String family = pMIME.substring(0, pMIME.length() - 1);
Set<String> extensions = new LinkedHashSet<String>();
for (Map.Entry<String, List<String>> mimeToExt : sMIMEToExt.entrySet()) {
if ("*/".equals(... | java | private static List<String> getExtensionForWildcard(final String pMIME) {
final String family = pMIME.substring(0, pMIME.length() - 1);
Set<String> extensions = new LinkedHashSet<String>();
for (Map.Entry<String, List<String>> mimeToExt : sMIMEToExt.entrySet()) {
if ("*/".equals(... | [
"private",
"static",
"List",
"<",
"String",
">",
"getExtensionForWildcard",
"(",
"final",
"String",
"pMIME",
")",
"{",
"final",
"String",
"family",
"=",
"pMIME",
".",
"substring",
"(",
"0",
",",
"pMIME",
".",
"length",
"(",
")",
"-",
"1",
")",
";",
"Se... | Gets all extensions for a wildcard MIME type | [
"Gets",
"all",
"extensions",
"for",
"a",
"wildcard",
"MIME",
"type"
] | 7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d | https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/common/common-io/src/main/java/com/twelvemonkeys/net/MIMEUtil.java#L173-L182 |
62,493 | haraldk/TwelveMonkeys | common/common-io/src/main/java/com/twelvemonkeys/net/MIMEUtil.java | MIMEUtil.maskNull | private static List<String> maskNull(List<String> pTypes) {
return (pTypes == null) ? Collections.<String>emptyList() : pTypes;
} | java | private static List<String> maskNull(List<String> pTypes) {
return (pTypes == null) ? Collections.<String>emptyList() : pTypes;
} | [
"private",
"static",
"List",
"<",
"String",
">",
"maskNull",
"(",
"List",
"<",
"String",
">",
"pTypes",
")",
"{",
"return",
"(",
"pTypes",
"==",
"null",
")",
"?",
"Collections",
".",
"<",
"String",
">",
"emptyList",
"(",
")",
":",
"pTypes",
";",
"}"
... | Returns the list or empty list if list is null | [
"Returns",
"the",
"list",
"or",
"empty",
"list",
"if",
"list",
"is",
"null"
] | 7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d | https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/common/common-io/src/main/java/com/twelvemonkeys/net/MIMEUtil.java#L230-L232 |
62,494 | haraldk/TwelveMonkeys | imageio/imageio-pcx/src/main/java/com/twelvemonkeys/imageio/plugins/pcx/RLEDecoder.java | RLEDecoder.decode | public int decode(final InputStream stream, final ByteBuffer buffer) throws IOException {
while (buffer.remaining() >= 64) {
int val = stream.read();
if (val < 0) {
break; // EOF
}
if ((val & COMPRESSED_RUN_MASK) == COMPRESSED_RUN_MASK) {
... | java | public int decode(final InputStream stream, final ByteBuffer buffer) throws IOException {
while (buffer.remaining() >= 64) {
int val = stream.read();
if (val < 0) {
break; // EOF
}
if ((val & COMPRESSED_RUN_MASK) == COMPRESSED_RUN_MASK) {
... | [
"public",
"int",
"decode",
"(",
"final",
"InputStream",
"stream",
",",
"final",
"ByteBuffer",
"buffer",
")",
"throws",
"IOException",
"{",
"while",
"(",
"buffer",
".",
"remaining",
"(",
")",
">=",
"64",
")",
"{",
"int",
"val",
"=",
"stream",
".",
"read",... | even if this will make the output larger. | [
"even",
"if",
"this",
"will",
"make",
"the",
"output",
"larger",
"."
] | 7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d | https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/imageio/imageio-pcx/src/main/java/com/twelvemonkeys/imageio/plugins/pcx/RLEDecoder.java#L47-L72 |
62,495 | haraldk/TwelveMonkeys | sandbox/sandbox-common/src/main/java/com/twelvemonkeys/util/regex/REWildcardStringParser.java | REWildcardStringParser.buildRegexpParser | private boolean buildRegexpParser() {
// Convert wildcard string mask to regular expression
String regexp = convertWildcardExpressionToRegularExpression(mStringMask);
if (regexp == null) {
out.println(DebugUtil.getPrefixErrorMessage(this)
+ "irregularity in regexp conversion... | java | private boolean buildRegexpParser() {
// Convert wildcard string mask to regular expression
String regexp = convertWildcardExpressionToRegularExpression(mStringMask);
if (regexp == null) {
out.println(DebugUtil.getPrefixErrorMessage(this)
+ "irregularity in regexp conversion... | [
"private",
"boolean",
"buildRegexpParser",
"(",
")",
"{",
"// Convert wildcard string mask to regular expression\r",
"String",
"regexp",
"=",
"convertWildcardExpressionToRegularExpression",
"(",
"mStringMask",
")",
";",
"if",
"(",
"regexp",
"==",
"null",
")",
"{",
"out",
... | Builds the regexp parser. | [
"Builds",
"the",
"regexp",
"parser",
"."
] | 7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d | https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/sandbox/sandbox-common/src/main/java/com/twelvemonkeys/util/regex/REWildcardStringParser.java#L196-L226 |
62,496 | haraldk/TwelveMonkeys | sandbox/sandbox-common/src/main/java/com/twelvemonkeys/util/regex/REWildcardStringParser.java | REWildcardStringParser.checkStringToBeParsed | private boolean checkStringToBeParsed(final String pStringToBeParsed) {
// Check for nullness
if (pStringToBeParsed == null) {
if (mDebugging) {
out.println(DebugUtil.getPrefixDebugMessage(this) + "string to be parsed is null - rejection!");
}
return false;
}
// Che... | java | private boolean checkStringToBeParsed(final String pStringToBeParsed) {
// Check for nullness
if (pStringToBeParsed == null) {
if (mDebugging) {
out.println(DebugUtil.getPrefixDebugMessage(this) + "string to be parsed is null - rejection!");
}
return false;
}
// Che... | [
"private",
"boolean",
"checkStringToBeParsed",
"(",
"final",
"String",
"pStringToBeParsed",
")",
"{",
"// Check for nullness\r",
"if",
"(",
"pStringToBeParsed",
"==",
"null",
")",
"{",
"if",
"(",
"mDebugging",
")",
"{",
"out",
".",
"println",
"(",
"DebugUtil",
"... | Simple check of the string to be parsed. | [
"Simple",
"check",
"of",
"the",
"string",
"to",
"be",
"parsed",
"."
] | 7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d | https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/sandbox/sandbox-common/src/main/java/com/twelvemonkeys/util/regex/REWildcardStringParser.java#L231-L252 |
62,497 | haraldk/TwelveMonkeys | sandbox/sandbox-common/src/main/java/com/twelvemonkeys/util/regex/REWildcardStringParser.java | REWildcardStringParser.isInAlphabet | public static boolean isInAlphabet(final char pCharToCheck) {
for (int i = 0; i < ALPHABET.length; i++) {
if (pCharToCheck == ALPHABET[i]) {
return true;
}
}
return false;
} | java | public static boolean isInAlphabet(final char pCharToCheck) {
for (int i = 0; i < ALPHABET.length; i++) {
if (pCharToCheck == ALPHABET[i]) {
return true;
}
}
return false;
} | [
"public",
"static",
"boolean",
"isInAlphabet",
"(",
"final",
"char",
"pCharToCheck",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"ALPHABET",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"pCharToCheck",
"==",
"ALPHABET",
"[",
"i"... | Tests if a certain character is a valid character in the alphabet that is applying for this automaton. | [
"Tests",
"if",
"a",
"certain",
"character",
"is",
"a",
"valid",
"character",
"in",
"the",
"alphabet",
"that",
"is",
"applying",
"for",
"this",
"automaton",
"."
] | 7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d | https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/sandbox/sandbox-common/src/main/java/com/twelvemonkeys/util/regex/REWildcardStringParser.java#L257-L265 |
62,498 | haraldk/TwelveMonkeys | common/common-lang/src/main/java/com/twelvemonkeys/util/CollectionUtil.java | CollectionUtil.main | @SuppressWarnings({"UnusedDeclaration", "UnusedAssignment", "unchecked"})
public static void main(String[] pArgs) {
int howMany = 1000;
if (pArgs.length > 0) {
howMany = Integer.parseInt(pArgs[0]);
}
long start;
long end;
/*
int[] intArr... | java | @SuppressWarnings({"UnusedDeclaration", "UnusedAssignment", "unchecked"})
public static void main(String[] pArgs) {
int howMany = 1000;
if (pArgs.length > 0) {
howMany = Integer.parseInt(pArgs[0]);
}
long start;
long end;
/*
int[] intArr... | [
"@",
"SuppressWarnings",
"(",
"{",
"\"UnusedDeclaration\"",
",",
"\"UnusedAssignment\"",
",",
"\"unchecked\"",
"}",
")",
"public",
"static",
"void",
"main",
"(",
"String",
"[",
"]",
"pArgs",
")",
"{",
"int",
"howMany",
"=",
"1000",
";",
"if",
"(",
"pArgs",
... | Testing only.
@param pArgs command line arguents | [
"Testing",
"only",
"."
] | 7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d | https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/common/common-lang/src/main/java/com/twelvemonkeys/util/CollectionUtil.java#L58-L205 |
62,499 | haraldk/TwelveMonkeys | common/common-lang/src/main/java/com/twelvemonkeys/util/CollectionUtil.java | CollectionUtil.mergeArrays | public static Object mergeArrays(Object pArray1, Object pArray2) {
return mergeArrays(pArray1, 0, Array.getLength(pArray1), pArray2, 0, Array.getLength(pArray2));
} | java | public static Object mergeArrays(Object pArray1, Object pArray2) {
return mergeArrays(pArray1, 0, Array.getLength(pArray1), pArray2, 0, Array.getLength(pArray2));
} | [
"public",
"static",
"Object",
"mergeArrays",
"(",
"Object",
"pArray1",
",",
"Object",
"pArray2",
")",
"{",
"return",
"mergeArrays",
"(",
"pArray1",
",",
"0",
",",
"Array",
".",
"getLength",
"(",
"pArray1",
")",
",",
"pArray2",
",",
"0",
",",
"Array",
"."... | Merges two arrays into a new array. Elements from array1 and array2 will
be copied into a new array, that has array1.length + array2.length
elements.
@param pArray1 First array
@param pArray2 Second array, must be compatible with (assignable from)
the first array
@return A new array, containing the values of array1 an... | [
"Merges",
"two",
"arrays",
"into",
"a",
"new",
"array",
".",
"Elements",
"from",
"array1",
"and",
"array2",
"will",
"be",
"copied",
"into",
"a",
"new",
"array",
"that",
"has",
"array1",
".",
"length",
"+",
"array2",
".",
"length",
"elements",
"."
] | 7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d | https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/common/common-lang/src/main/java/com/twelvemonkeys/util/CollectionUtil.java#L225-L227 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.