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
|
|---|---|---|---|---|---|---|---|---|---|---|---|
150,600
|
jtrfp/javamod
|
src/main/java/de/quippy/jflac/metadata/SeekPoint.java
|
SeekPoint.write
|
public void write(BitOutputStream os) throws IOException {
os.writeRawULong(sampleNumber, SEEKPOINT_SAMPLE_NUMBER_LEN);
os.writeRawULong(streamOffset, SEEKPOINT_STREAM_OFFSET_LEN);
os.writeRawUInt(frameSamples, SEEKPOINT_FRAME_SAMPLES_LEN);
}
|
java
|
public void write(BitOutputStream os) throws IOException {
os.writeRawULong(sampleNumber, SEEKPOINT_SAMPLE_NUMBER_LEN);
os.writeRawULong(streamOffset, SEEKPOINT_STREAM_OFFSET_LEN);
os.writeRawUInt(frameSamples, SEEKPOINT_FRAME_SAMPLES_LEN);
}
|
[
"public",
"void",
"write",
"(",
"BitOutputStream",
"os",
")",
"throws",
"IOException",
"{",
"os",
".",
"writeRawULong",
"(",
"sampleNumber",
",",
"SEEKPOINT_SAMPLE_NUMBER_LEN",
")",
";",
"os",
".",
"writeRawULong",
"(",
"streamOffset",
",",
"SEEKPOINT_STREAM_OFFSET_LEN",
")",
";",
"os",
".",
"writeRawUInt",
"(",
"frameSamples",
",",
"SEEKPOINT_FRAME_SAMPLES_LEN",
")",
";",
"}"
] |
Write out an individual seek point.
@param os The output stream
@throws IOException Thrown if error writing data
|
[
"Write",
"out",
"an",
"individual",
"seek",
"point",
"."
] |
cda4fe943a589dc49415f4413453e2eece72076a
|
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/jflac/metadata/SeekPoint.java#L70-L75
|
150,601
|
lecousin/java-framework-core
|
net.lecousin.core/src/main/java/net/lecousin/framework/application/libraries/classloader/AbstractClassLoader.java
|
AbstractClassLoader.addSubLoader
|
public final void addSubLoader(AbstractClassLoader loader) {
if (subLoaders == null) subLoaders = new ArrayList<>();
subLoaders.add(loader);
}
|
java
|
public final void addSubLoader(AbstractClassLoader loader) {
if (subLoaders == null) subLoaders = new ArrayList<>();
subLoaders.add(loader);
}
|
[
"public",
"final",
"void",
"addSubLoader",
"(",
"AbstractClassLoader",
"loader",
")",
"{",
"if",
"(",
"subLoaders",
"==",
"null",
")",
"subLoaders",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"subLoaders",
".",
"add",
"(",
"loader",
")",
";",
"}"
] |
Add a class loader from a resource contained by this class loader, for example an inner jar file.
|
[
"Add",
"a",
"class",
"loader",
"from",
"a",
"resource",
"contained",
"by",
"this",
"class",
"loader",
"for",
"example",
"an",
"inner",
"jar",
"file",
"."
] |
b0c893b44bfde2c03f90ea846a49ef5749d598f3
|
https://github.com/lecousin/java-framework-core/blob/b0c893b44bfde2c03f90ea846a49ef5749d598f3/net.lecousin.core/src/main/java/net/lecousin/framework/application/libraries/classloader/AbstractClassLoader.java#L69-L72
|
150,602
|
lecousin/java-framework-core
|
net.lecousin.core/src/main/java/net/lecousin/framework/application/libraries/classloader/AbstractClassLoader.java
|
AbstractClassLoader.getClassLoadingSP
|
public static ISynchronizationPoint<NoException> getClassLoadingSP(String name) {
synchronized (classLoadingSP) {
Pair<Thread,JoinPoint<NoException>> p = classLoadingSP.get(name);
if (p == null) {
JoinPoint<NoException> jp = new JoinPoint<NoException>();
jp.addToJoin(1);
jp.start();
classLoadingSP.put(name, new Pair<Thread,JoinPoint<NoException>>(Thread.currentThread(), jp));
return null;
}
if (p.getValue1() == Thread.currentThread()) {
p.getValue2().addToJoin(1);
return null;
}
return p.getValue2();
}
}
|
java
|
public static ISynchronizationPoint<NoException> getClassLoadingSP(String name) {
synchronized (classLoadingSP) {
Pair<Thread,JoinPoint<NoException>> p = classLoadingSP.get(name);
if (p == null) {
JoinPoint<NoException> jp = new JoinPoint<NoException>();
jp.addToJoin(1);
jp.start();
classLoadingSP.put(name, new Pair<Thread,JoinPoint<NoException>>(Thread.currentThread(), jp));
return null;
}
if (p.getValue1() == Thread.currentThread()) {
p.getValue2().addToJoin(1);
return null;
}
return p.getValue2();
}
}
|
[
"public",
"static",
"ISynchronizationPoint",
"<",
"NoException",
">",
"getClassLoadingSP",
"(",
"String",
"name",
")",
"{",
"synchronized",
"(",
"classLoadingSP",
")",
"{",
"Pair",
"<",
"Thread",
",",
"JoinPoint",
"<",
"NoException",
">",
">",
"p",
"=",
"classLoadingSP",
".",
"get",
"(",
"name",
")",
";",
"if",
"(",
"p",
"==",
"null",
")",
"{",
"JoinPoint",
"<",
"NoException",
">",
"jp",
"=",
"new",
"JoinPoint",
"<",
"NoException",
">",
"(",
")",
";",
"jp",
".",
"addToJoin",
"(",
"1",
")",
";",
"jp",
".",
"start",
"(",
")",
";",
"classLoadingSP",
".",
"put",
"(",
"name",
",",
"new",
"Pair",
"<",
"Thread",
",",
"JoinPoint",
"<",
"NoException",
">",
">",
"(",
"Thread",
".",
"currentThread",
"(",
")",
",",
"jp",
")",
")",
";",
"return",
"null",
";",
"}",
"if",
"(",
"p",
".",
"getValue1",
"(",
")",
"==",
"Thread",
".",
"currentThread",
"(",
")",
")",
"{",
"p",
".",
"getValue2",
"(",
")",
".",
"addToJoin",
"(",
"1",
")",
";",
"return",
"null",
";",
"}",
"return",
"p",
".",
"getValue2",
"(",
")",
";",
"}",
"}"
] |
Get the synchronized object for loading the given class.
|
[
"Get",
"the",
"synchronized",
"object",
"for",
"loading",
"the",
"given",
"class",
"."
] |
b0c893b44bfde2c03f90ea846a49ef5749d598f3
|
https://github.com/lecousin/java-framework-core/blob/b0c893b44bfde2c03f90ea846a49ef5749d598f3/net.lecousin.core/src/main/java/net/lecousin/framework/application/libraries/classloader/AbstractClassLoader.java#L77-L93
|
150,603
|
lecousin/java-framework-core
|
net.lecousin.core/src/main/java/net/lecousin/framework/application/libraries/classloader/AbstractClassLoader.java
|
AbstractClassLoader.releaseClassLoadingSP
|
public static void releaseClassLoadingSP(String name) {
synchronized (classLoadingSP) {
Pair<Thread,JoinPoint<NoException>> sp = classLoadingSP.get(name);
JoinPoint<NoException> jp = sp.getValue2();
jp.joined();
if (jp.isUnblocked())
classLoadingSP.remove(name);
}
}
|
java
|
public static void releaseClassLoadingSP(String name) {
synchronized (classLoadingSP) {
Pair<Thread,JoinPoint<NoException>> sp = classLoadingSP.get(name);
JoinPoint<NoException> jp = sp.getValue2();
jp.joined();
if (jp.isUnblocked())
classLoadingSP.remove(name);
}
}
|
[
"public",
"static",
"void",
"releaseClassLoadingSP",
"(",
"String",
"name",
")",
"{",
"synchronized",
"(",
"classLoadingSP",
")",
"{",
"Pair",
"<",
"Thread",
",",
"JoinPoint",
"<",
"NoException",
">",
">",
"sp",
"=",
"classLoadingSP",
".",
"get",
"(",
"name",
")",
";",
"JoinPoint",
"<",
"NoException",
">",
"jp",
"=",
"sp",
".",
"getValue2",
"(",
")",
";",
"jp",
".",
"joined",
"(",
")",
";",
"if",
"(",
"jp",
".",
"isUnblocked",
"(",
")",
")",
"classLoadingSP",
".",
"remove",
"(",
"name",
")",
";",
"}",
"}"
] |
Release the synchronized object for loading the given class.
|
[
"Release",
"the",
"synchronized",
"object",
"for",
"loading",
"the",
"given",
"class",
"."
] |
b0c893b44bfde2c03f90ea846a49ef5749d598f3
|
https://github.com/lecousin/java-framework-core/blob/b0c893b44bfde2c03f90ea846a49ef5749d598f3/net.lecousin.core/src/main/java/net/lecousin/framework/application/libraries/classloader/AbstractClassLoader.java#L96-L104
|
150,604
|
lecousin/java-framework-core
|
net.lecousin.core/src/main/java/net/lecousin/framework/application/libraries/classloader/AbstractClassLoader.java
|
AbstractClassLoader.open
|
public final IO.Readable open(String path, byte priority) throws IOException {
Object pointer = getResourcePointer(path);
AbstractClassLoader cl = this;
if (pointer == null) {
if (subLoaders != null)
for (AbstractClassLoader sub : subLoaders) {
pointer = sub.getResourcePointer(path);
if (pointer != null) {
cl = sub;
break;
}
}
if (pointer == null)
throw new FileNotFoundException(path);
}
return cl.openResourcePointer(pointer, priority);
}
|
java
|
public final IO.Readable open(String path, byte priority) throws IOException {
Object pointer = getResourcePointer(path);
AbstractClassLoader cl = this;
if (pointer == null) {
if (subLoaders != null)
for (AbstractClassLoader sub : subLoaders) {
pointer = sub.getResourcePointer(path);
if (pointer != null) {
cl = sub;
break;
}
}
if (pointer == null)
throw new FileNotFoundException(path);
}
return cl.openResourcePointer(pointer, priority);
}
|
[
"public",
"final",
"IO",
".",
"Readable",
"open",
"(",
"String",
"path",
",",
"byte",
"priority",
")",
"throws",
"IOException",
"{",
"Object",
"pointer",
"=",
"getResourcePointer",
"(",
"path",
")",
";",
"AbstractClassLoader",
"cl",
"=",
"this",
";",
"if",
"(",
"pointer",
"==",
"null",
")",
"{",
"if",
"(",
"subLoaders",
"!=",
"null",
")",
"for",
"(",
"AbstractClassLoader",
"sub",
":",
"subLoaders",
")",
"{",
"pointer",
"=",
"sub",
".",
"getResourcePointer",
"(",
"path",
")",
";",
"if",
"(",
"pointer",
"!=",
"null",
")",
"{",
"cl",
"=",
"sub",
";",
"break",
";",
"}",
"}",
"if",
"(",
"pointer",
"==",
"null",
")",
"throw",
"new",
"FileNotFoundException",
"(",
"path",
")",
";",
"}",
"return",
"cl",
".",
"openResourcePointer",
"(",
"pointer",
",",
"priority",
")",
";",
"}"
] |
Open a resource.
|
[
"Open",
"a",
"resource",
"."
] |
b0c893b44bfde2c03f90ea846a49ef5749d598f3
|
https://github.com/lecousin/java-framework-core/blob/b0c893b44bfde2c03f90ea846a49ef5749d598f3/net.lecousin.core/src/main/java/net/lecousin/framework/application/libraries/classloader/AbstractClassLoader.java#L199-L215
|
150,605
|
lecousin/java-framework-core
|
net.lecousin.core/src/main/java/net/lecousin/framework/application/libraries/classloader/AbstractClassLoader.java
|
AbstractClassLoader.getResourcesURL
|
public final Iterable<URL> getResourcesURL(String name) {
URL url = loadResourceURL(name);
if (subLoaders == null)
return url != null ? Collections.singletonList(url) : null;
CompoundCollection<URL> list = new CompoundCollection<>();
if (url != null) list.addSingleton(url);
for (AbstractClassLoader sub : subLoaders) {
Iterable<URL> urls = sub.getResourcesURL(name);
if (urls != null) list.add(urls);
}
return list;
}
|
java
|
public final Iterable<URL> getResourcesURL(String name) {
URL url = loadResourceURL(name);
if (subLoaders == null)
return url != null ? Collections.singletonList(url) : null;
CompoundCollection<URL> list = new CompoundCollection<>();
if (url != null) list.addSingleton(url);
for (AbstractClassLoader sub : subLoaders) {
Iterable<URL> urls = sub.getResourcesURL(name);
if (urls != null) list.add(urls);
}
return list;
}
|
[
"public",
"final",
"Iterable",
"<",
"URL",
">",
"getResourcesURL",
"(",
"String",
"name",
")",
"{",
"URL",
"url",
"=",
"loadResourceURL",
"(",
"name",
")",
";",
"if",
"(",
"subLoaders",
"==",
"null",
")",
"return",
"url",
"!=",
"null",
"?",
"Collections",
".",
"singletonList",
"(",
"url",
")",
":",
"null",
";",
"CompoundCollection",
"<",
"URL",
">",
"list",
"=",
"new",
"CompoundCollection",
"<>",
"(",
")",
";",
"if",
"(",
"url",
"!=",
"null",
")",
"list",
".",
"addSingleton",
"(",
"url",
")",
";",
"for",
"(",
"AbstractClassLoader",
"sub",
":",
"subLoaders",
")",
"{",
"Iterable",
"<",
"URL",
">",
"urls",
"=",
"sub",
".",
"getResourcesURL",
"(",
"name",
")",
";",
"if",
"(",
"urls",
"!=",
"null",
")",
"list",
".",
"add",
"(",
"urls",
")",
";",
"}",
"return",
"list",
";",
"}"
] |
Search for all resources with the same path.
|
[
"Search",
"for",
"all",
"resources",
"with",
"the",
"same",
"path",
"."
] |
b0c893b44bfde2c03f90ea846a49ef5749d598f3
|
https://github.com/lecousin/java-framework-core/blob/b0c893b44bfde2c03f90ea846a49ef5749d598f3/net.lecousin.core/src/main/java/net/lecousin/framework/application/libraries/classloader/AbstractClassLoader.java#L229-L240
|
150,606
|
jtrfp/javamod
|
src/main/java/de/quippy/javamod/multimedia/mp3/id3/MPEGAudioFrameHeader.java
|
MPEGAudioFrameHeader.findFrame
|
private long findFrame(RandomAccessInputStream raf, int offset) throws IOException
{
long loc = -1;
raf.seek(offset);
while (loc == -1)
{
byte test = raf.readByte();
if ((test & 0xFF) == 0xFF)
{
test = raf.readByte();
if ((test & 0xE0) == 0xE0)
{
return raf.getFilePointer() - 2;
}
}
}
return -1;
}
|
java
|
private long findFrame(RandomAccessInputStream raf, int offset) throws IOException
{
long loc = -1;
raf.seek(offset);
while (loc == -1)
{
byte test = raf.readByte();
if ((test & 0xFF) == 0xFF)
{
test = raf.readByte();
if ((test & 0xE0) == 0xE0)
{
return raf.getFilePointer() - 2;
}
}
}
return -1;
}
|
[
"private",
"long",
"findFrame",
"(",
"RandomAccessInputStream",
"raf",
",",
"int",
"offset",
")",
"throws",
"IOException",
"{",
"long",
"loc",
"=",
"-",
"1",
";",
"raf",
".",
"seek",
"(",
"offset",
")",
";",
"while",
"(",
"loc",
"==",
"-",
"1",
")",
"{",
"byte",
"test",
"=",
"raf",
".",
"readByte",
"(",
")",
";",
"if",
"(",
"(",
"test",
"&",
"0xFF",
")",
"==",
"0xFF",
")",
"{",
"test",
"=",
"raf",
".",
"readByte",
"(",
")",
";",
"if",
"(",
"(",
"test",
"&",
"0xE0",
")",
"==",
"0xE0",
")",
"{",
"return",
"raf",
".",
"getFilePointer",
"(",
")",
"-",
"2",
";",
"}",
"}",
"}",
"return",
"-",
"1",
";",
"}"
] |
Searches through the file and finds the first occurrence of an mpeg
frame. Returns the location of the header of the frame.
@param offset the offset to start searching from
@return the location of the header of the frame
@exception FileNotFoundException if an error occurs
@exception IOException if an error occurs
|
[
"Searches",
"through",
"the",
"file",
"and",
"finds",
"the",
"first",
"occurrence",
"of",
"an",
"mpeg",
"frame",
".",
"Returns",
"the",
"location",
"of",
"the",
"header",
"of",
"the",
"frame",
"."
] |
cda4fe943a589dc49415f4413453e2eece72076a
|
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/javamod/multimedia/mp3/id3/MPEGAudioFrameHeader.java#L194-L215
|
150,607
|
jtrfp/javamod
|
src/main/java/de/quippy/javamod/multimedia/mp3/id3/MPEGAudioFrameHeader.java
|
MPEGAudioFrameHeader.readHeader
|
private void readHeader(RandomAccessInputStream raf, long location) throws IOException
{
byte[] head = new byte[HEADER_SIZE];
raf.seek(location);
if (raf.read(head) != HEADER_SIZE)
{
throw new IOException("Error reading MPEG frame header.");
}
version = (head[1]&0x18)>>3;
layer = (head[1]&0x06)>>1;
crced = (head[1]&0x01)==0;
bitRate = findBitRate((head[2]&0xF0)>>4, version, layer);
sampleRate = findSampleRate((head[2]&0x0C)>>2, version);
channelMode = (head[3]&0xC0)>>6;
copyrighted = (head[3]&0x08)!=0;
original = (head[3]&0x04)!=0;
emphasis = head[3]&0x03;
}
|
java
|
private void readHeader(RandomAccessInputStream raf, long location) throws IOException
{
byte[] head = new byte[HEADER_SIZE];
raf.seek(location);
if (raf.read(head) != HEADER_SIZE)
{
throw new IOException("Error reading MPEG frame header.");
}
version = (head[1]&0x18)>>3;
layer = (head[1]&0x06)>>1;
crced = (head[1]&0x01)==0;
bitRate = findBitRate((head[2]&0xF0)>>4, version, layer);
sampleRate = findSampleRate((head[2]&0x0C)>>2, version);
channelMode = (head[3]&0xC0)>>6;
copyrighted = (head[3]&0x08)!=0;
original = (head[3]&0x04)!=0;
emphasis = head[3]&0x03;
}
|
[
"private",
"void",
"readHeader",
"(",
"RandomAccessInputStream",
"raf",
",",
"long",
"location",
")",
"throws",
"IOException",
"{",
"byte",
"[",
"]",
"head",
"=",
"new",
"byte",
"[",
"HEADER_SIZE",
"]",
";",
"raf",
".",
"seek",
"(",
"location",
")",
";",
"if",
"(",
"raf",
".",
"read",
"(",
"head",
")",
"!=",
"HEADER_SIZE",
")",
"{",
"throw",
"new",
"IOException",
"(",
"\"Error reading MPEG frame header.\"",
")",
";",
"}",
"version",
"=",
"(",
"head",
"[",
"1",
"]",
"&",
"0x18",
")",
">>",
"3",
";",
"layer",
"=",
"(",
"head",
"[",
"1",
"]",
"&",
"0x06",
")",
">>",
"1",
";",
"crced",
"=",
"(",
"head",
"[",
"1",
"]",
"&",
"0x01",
")",
"==",
"0",
";",
"bitRate",
"=",
"findBitRate",
"(",
"(",
"head",
"[",
"2",
"]",
"&",
"0xF0",
")",
">>",
"4",
",",
"version",
",",
"layer",
")",
";",
"sampleRate",
"=",
"findSampleRate",
"(",
"(",
"head",
"[",
"2",
"]",
"&",
"0x0C",
")",
">>",
"2",
",",
"version",
")",
";",
"channelMode",
"=",
"(",
"head",
"[",
"3",
"]",
"&",
"0xC0",
")",
">>",
"6",
";",
"copyrighted",
"=",
"(",
"head",
"[",
"3",
"]",
"&",
"0x08",
")",
"!=",
"0",
";",
"original",
"=",
"(",
"head",
"[",
"3",
"]",
"&",
"0x04",
")",
"!=",
"0",
";",
"emphasis",
"=",
"head",
"[",
"3",
"]",
"&",
"0x03",
";",
"}"
] |
Read in all the information found in the mpeg header.
@param location the location of the header (found by findFrame)
@exception FileNotFoundException if an error occurs
@exception IOException if an error occurs
|
[
"Read",
"in",
"all",
"the",
"information",
"found",
"in",
"the",
"mpeg",
"header",
"."
] |
cda4fe943a589dc49415f4413453e2eece72076a
|
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/javamod/multimedia/mp3/id3/MPEGAudioFrameHeader.java#L224-L243
|
150,608
|
jtrfp/javamod
|
src/main/java/de/quippy/javamod/multimedia/mp3/id3/MPEGAudioFrameHeader.java
|
MPEGAudioFrameHeader.findBitRate
|
private int findBitRate(int bitrateIndex, int version, int layer)
{
int ind = -1;
if (version == MPEG_V_1)
{
if (layer == MPEG_L_1)
{
ind = 0;
}
else if (layer == MPEG_L_2)
{
ind = 1;
}
else if (layer == MPEG_L_3)
{
ind = 2;
}
}
else if ((version == MPEG_V_2) || (version == MPEG_V_25))
{
if (layer == MPEG_L_1)
{
ind = 3;
}
else if ((layer == MPEG_L_2) || (layer == MPEG_L_3))
{
ind = 4;
}
}
if ((ind != -1) && (bitrateIndex >= 0) && (bitrateIndex <= 15))
{
return bitrateTable[bitrateIndex][ind];
}
return -1;
}
|
java
|
private int findBitRate(int bitrateIndex, int version, int layer)
{
int ind = -1;
if (version == MPEG_V_1)
{
if (layer == MPEG_L_1)
{
ind = 0;
}
else if (layer == MPEG_L_2)
{
ind = 1;
}
else if (layer == MPEG_L_3)
{
ind = 2;
}
}
else if ((version == MPEG_V_2) || (version == MPEG_V_25))
{
if (layer == MPEG_L_1)
{
ind = 3;
}
else if ((layer == MPEG_L_2) || (layer == MPEG_L_3))
{
ind = 4;
}
}
if ((ind != -1) && (bitrateIndex >= 0) && (bitrateIndex <= 15))
{
return bitrateTable[bitrateIndex][ind];
}
return -1;
}
|
[
"private",
"int",
"findBitRate",
"(",
"int",
"bitrateIndex",
",",
"int",
"version",
",",
"int",
"layer",
")",
"{",
"int",
"ind",
"=",
"-",
"1",
";",
"if",
"(",
"version",
"==",
"MPEG_V_1",
")",
"{",
"if",
"(",
"layer",
"==",
"MPEG_L_1",
")",
"{",
"ind",
"=",
"0",
";",
"}",
"else",
"if",
"(",
"layer",
"==",
"MPEG_L_2",
")",
"{",
"ind",
"=",
"1",
";",
"}",
"else",
"if",
"(",
"layer",
"==",
"MPEG_L_3",
")",
"{",
"ind",
"=",
"2",
";",
"}",
"}",
"else",
"if",
"(",
"(",
"version",
"==",
"MPEG_V_2",
")",
"||",
"(",
"version",
"==",
"MPEG_V_25",
")",
")",
"{",
"if",
"(",
"layer",
"==",
"MPEG_L_1",
")",
"{",
"ind",
"=",
"3",
";",
"}",
"else",
"if",
"(",
"(",
"layer",
"==",
"MPEG_L_2",
")",
"||",
"(",
"layer",
"==",
"MPEG_L_3",
")",
")",
"{",
"ind",
"=",
"4",
";",
"}",
"}",
"if",
"(",
"(",
"ind",
"!=",
"-",
"1",
")",
"&&",
"(",
"bitrateIndex",
">=",
"0",
")",
"&&",
"(",
"bitrateIndex",
"<=",
"15",
")",
")",
"{",
"return",
"bitrateTable",
"[",
"bitrateIndex",
"]",
"[",
"ind",
"]",
";",
"}",
"return",
"-",
"1",
";",
"}"
] |
Based on the bitrate index found in the header, try to find and set the
bitrate from the table.
@param bitrateIndex the bitrate index read from the header
|
[
"Based",
"on",
"the",
"bitrate",
"index",
"found",
"in",
"the",
"header",
"try",
"to",
"find",
"and",
"set",
"the",
"bitrate",
"from",
"the",
"table",
"."
] |
cda4fe943a589dc49415f4413453e2eece72076a
|
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/javamod/multimedia/mp3/id3/MPEGAudioFrameHeader.java#L251-L287
|
150,609
|
jtrfp/javamod
|
src/main/java/de/quippy/javamod/multimedia/mp3/id3/MPEGAudioFrameHeader.java
|
MPEGAudioFrameHeader.findSampleRate
|
private int findSampleRate(int sampleIndex, int version)
{
int ind = -1;
switch (version)
{
case MPEG_V_1:
ind = 0;
break;
case MPEG_V_2:
ind = 1;
break;
case MPEG_V_25:
ind = 2;
}
if ((ind != -1) && (sampleIndex >= 0) && (sampleIndex <= 3))
{
return sampleTable[sampleIndex][ind];
}
return -1;
}
|
java
|
private int findSampleRate(int sampleIndex, int version)
{
int ind = -1;
switch (version)
{
case MPEG_V_1:
ind = 0;
break;
case MPEG_V_2:
ind = 1;
break;
case MPEG_V_25:
ind = 2;
}
if ((ind != -1) && (sampleIndex >= 0) && (sampleIndex <= 3))
{
return sampleTable[sampleIndex][ind];
}
return -1;
}
|
[
"private",
"int",
"findSampleRate",
"(",
"int",
"sampleIndex",
",",
"int",
"version",
")",
"{",
"int",
"ind",
"=",
"-",
"1",
";",
"switch",
"(",
"version",
")",
"{",
"case",
"MPEG_V_1",
":",
"ind",
"=",
"0",
";",
"break",
";",
"case",
"MPEG_V_2",
":",
"ind",
"=",
"1",
";",
"break",
";",
"case",
"MPEG_V_25",
":",
"ind",
"=",
"2",
";",
"}",
"if",
"(",
"(",
"ind",
"!=",
"-",
"1",
")",
"&&",
"(",
"sampleIndex",
">=",
"0",
")",
"&&",
"(",
"sampleIndex",
"<=",
"3",
")",
")",
"{",
"return",
"sampleTable",
"[",
"sampleIndex",
"]",
"[",
"ind",
"]",
";",
"}",
"return",
"-",
"1",
";",
"}"
] |
Based on the sample rate index found in the header, attempt to lookup
and set the sample rate from the table.
@param sampleIndex the sample rate index read from the header
|
[
"Based",
"on",
"the",
"sample",
"rate",
"index",
"found",
"in",
"the",
"header",
"attempt",
"to",
"lookup",
"and",
"set",
"the",
"sample",
"rate",
"from",
"the",
"table",
"."
] |
cda4fe943a589dc49415f4413453e2eece72076a
|
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/javamod/multimedia/mp3/id3/MPEGAudioFrameHeader.java#L295-L316
|
150,610
|
jtrfp/javamod
|
src/main/java/de/quippy/javamod/multimedia/mp3/id3/MPEGAudioFrameHeader.java
|
MPEGAudioFrameHeader.getEmphasis
|
public String getEmphasis()
{
String str = null;
if ((emphasis >= 0) && (emphasis < emphasisLabels.length))
{
str = emphasisLabels[emphasis];
}
return str;
}
|
java
|
public String getEmphasis()
{
String str = null;
if ((emphasis >= 0) && (emphasis < emphasisLabels.length))
{
str = emphasisLabels[emphasis];
}
return str;
}
|
[
"public",
"String",
"getEmphasis",
"(",
")",
"{",
"String",
"str",
"=",
"null",
";",
"if",
"(",
"(",
"emphasis",
">=",
"0",
")",
"&&",
"(",
"emphasis",
"<",
"emphasisLabels",
".",
"length",
")",
")",
"{",
"str",
"=",
"emphasisLabels",
"[",
"emphasis",
"]",
";",
"}",
"return",
"str",
";",
"}"
] |
Returns the emphasis. I don't know what this means, it just does it...
@return the emphasis
|
[
"Returns",
"the",
"emphasis",
".",
"I",
"don",
"t",
"know",
"what",
"this",
"means",
"it",
"just",
"does",
"it",
"..."
] |
cda4fe943a589dc49415f4413453e2eece72076a
|
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/javamod/multimedia/mp3/id3/MPEGAudioFrameHeader.java#L438-L448
|
150,611
|
jtrfp/javamod
|
src/main/java/de/quippy/javamod/multimedia/mp3/id3/ID3v1Tag.java
|
ID3v1Tag.checkHeader
|
private boolean checkHeader(RandomAccessInputStream raf) throws FileNotFoundException, IOException
{
boolean retval = false;
if (raf.length() > TAG_SIZE)
{
raf.seek(raf.length() - TAG_SIZE);
byte[] buf = new byte[3];
if (raf.read(buf) != 3)
{
throw new IOException("Error encountered reading ID3 header");
}
else
{
String result = new String(buf, 0, 3, ENC_TYPE);
retval = result.equals(TAG_START);
}
}
return retval;
}
|
java
|
private boolean checkHeader(RandomAccessInputStream raf) throws FileNotFoundException, IOException
{
boolean retval = false;
if (raf.length() > TAG_SIZE)
{
raf.seek(raf.length() - TAG_SIZE);
byte[] buf = new byte[3];
if (raf.read(buf) != 3)
{
throw new IOException("Error encountered reading ID3 header");
}
else
{
String result = new String(buf, 0, 3, ENC_TYPE);
retval = result.equals(TAG_START);
}
}
return retval;
}
|
[
"private",
"boolean",
"checkHeader",
"(",
"RandomAccessInputStream",
"raf",
")",
"throws",
"FileNotFoundException",
",",
"IOException",
"{",
"boolean",
"retval",
"=",
"false",
";",
"if",
"(",
"raf",
".",
"length",
"(",
")",
">",
"TAG_SIZE",
")",
"{",
"raf",
".",
"seek",
"(",
"raf",
".",
"length",
"(",
")",
"-",
"TAG_SIZE",
")",
";",
"byte",
"[",
"]",
"buf",
"=",
"new",
"byte",
"[",
"3",
"]",
";",
"if",
"(",
"raf",
".",
"read",
"(",
"buf",
")",
"!=",
"3",
")",
"{",
"throw",
"new",
"IOException",
"(",
"\"Error encountered reading ID3 header\"",
")",
";",
"}",
"else",
"{",
"String",
"result",
"=",
"new",
"String",
"(",
"buf",
",",
"0",
",",
"3",
",",
"ENC_TYPE",
")",
";",
"retval",
"=",
"result",
".",
"equals",
"(",
"TAG_START",
")",
";",
"}",
"}",
"return",
"retval",
";",
"}"
] |
Checks whether a header for the id3 tag exists yet
@return true if a tag is found
@exception FileNotFoundException if an error occurs
@exception IOException if an error occurs
|
[
"Checks",
"whether",
"a",
"header",
"for",
"the",
"id3",
"tag",
"exists",
"yet"
] |
cda4fe943a589dc49415f4413453e2eece72076a
|
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/javamod/multimedia/mp3/id3/ID3v1Tag.java#L107-L128
|
150,612
|
jtrfp/javamod
|
src/main/java/de/quippy/javamod/multimedia/mp3/id3/ID3v1Tag.java
|
ID3v1Tag.readTag
|
private void readTag(RandomAccessInputStream raf) throws FileNotFoundException, IOException
{
raf.seek(raf.length() - TAG_SIZE);
byte[] buf = new byte[TAG_SIZE];
raf.read(buf, 0, TAG_SIZE);
String tag = new String(buf, 0, TAG_SIZE, ENC_TYPE);
int start = TAG_START.length();
title = tag.substring(start, start += TITLE_SIZE);
artist = tag.substring(start, start += ARTIST_SIZE);
album = tag.substring(start, start += ALBUM_SIZE);
year = tag.substring(start, start += YEAR_SIZE);
comment = tag.substring(start, start += COMMENT_SIZE);
track = (int) tag.charAt(TRACK_LOCATION);
genre = (int) tag.charAt(GENRE_LOCATION);
}
|
java
|
private void readTag(RandomAccessInputStream raf) throws FileNotFoundException, IOException
{
raf.seek(raf.length() - TAG_SIZE);
byte[] buf = new byte[TAG_SIZE];
raf.read(buf, 0, TAG_SIZE);
String tag = new String(buf, 0, TAG_SIZE, ENC_TYPE);
int start = TAG_START.length();
title = tag.substring(start, start += TITLE_SIZE);
artist = tag.substring(start, start += ARTIST_SIZE);
album = tag.substring(start, start += ALBUM_SIZE);
year = tag.substring(start, start += YEAR_SIZE);
comment = tag.substring(start, start += COMMENT_SIZE);
track = (int) tag.charAt(TRACK_LOCATION);
genre = (int) tag.charAt(GENRE_LOCATION);
}
|
[
"private",
"void",
"readTag",
"(",
"RandomAccessInputStream",
"raf",
")",
"throws",
"FileNotFoundException",
",",
"IOException",
"{",
"raf",
".",
"seek",
"(",
"raf",
".",
"length",
"(",
")",
"-",
"TAG_SIZE",
")",
";",
"byte",
"[",
"]",
"buf",
"=",
"new",
"byte",
"[",
"TAG_SIZE",
"]",
";",
"raf",
".",
"read",
"(",
"buf",
",",
"0",
",",
"TAG_SIZE",
")",
";",
"String",
"tag",
"=",
"new",
"String",
"(",
"buf",
",",
"0",
",",
"TAG_SIZE",
",",
"ENC_TYPE",
")",
";",
"int",
"start",
"=",
"TAG_START",
".",
"length",
"(",
")",
";",
"title",
"=",
"tag",
".",
"substring",
"(",
"start",
",",
"start",
"+=",
"TITLE_SIZE",
")",
";",
"artist",
"=",
"tag",
".",
"substring",
"(",
"start",
",",
"start",
"+=",
"ARTIST_SIZE",
")",
";",
"album",
"=",
"tag",
".",
"substring",
"(",
"start",
",",
"start",
"+=",
"ALBUM_SIZE",
")",
";",
"year",
"=",
"tag",
".",
"substring",
"(",
"start",
",",
"start",
"+=",
"YEAR_SIZE",
")",
";",
"comment",
"=",
"tag",
".",
"substring",
"(",
"start",
",",
"start",
"+=",
"COMMENT_SIZE",
")",
";",
"track",
"=",
"(",
"int",
")",
"tag",
".",
"charAt",
"(",
"TRACK_LOCATION",
")",
";",
"genre",
"=",
"(",
"int",
")",
"tag",
".",
"charAt",
"(",
"GENRE_LOCATION",
")",
";",
"}"
] |
Reads the data from the id3v1 tag
@exception FileNotFoundException if an error occurs
@exception IOException if an error occurs
|
[
"Reads",
"the",
"data",
"from",
"the",
"id3v1",
"tag"
] |
cda4fe943a589dc49415f4413453e2eece72076a
|
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/javamod/multimedia/mp3/id3/ID3v1Tag.java#L136-L150
|
150,613
|
jtrfp/javamod
|
src/main/java/de/quippy/javamod/multimedia/mp3/id3/ID3v1Tag.java
|
ID3v1Tag.writeTag
|
public void writeTag(RandomAccessFile raf) throws FileNotFoundException, IOException
{
if (headerExists)
raf.seek(raf.length() - TAG_SIZE);
else
raf.seek(raf.length());
raf.write(Helpers.getBytesFromString(TAG_START, TAG_START.length(), ENC_TYPE));
raf.write(Helpers.getBytesFromString(title, TITLE_SIZE, ENC_TYPE));
raf.write(Helpers.getBytesFromString(artist, ARTIST_SIZE, ENC_TYPE));
raf.write(Helpers.getBytesFromString(album, ALBUM_SIZE, ENC_TYPE));
raf.write(Helpers.getBytesFromString(year, YEAR_SIZE, ENC_TYPE));
raf.write(Helpers.getBytesFromString(comment, COMMENT_SIZE, ENC_TYPE));
raf.write((byte) track);
raf.write((byte) genre);
headerExists = true;
}
|
java
|
public void writeTag(RandomAccessFile raf) throws FileNotFoundException, IOException
{
if (headerExists)
raf.seek(raf.length() - TAG_SIZE);
else
raf.seek(raf.length());
raf.write(Helpers.getBytesFromString(TAG_START, TAG_START.length(), ENC_TYPE));
raf.write(Helpers.getBytesFromString(title, TITLE_SIZE, ENC_TYPE));
raf.write(Helpers.getBytesFromString(artist, ARTIST_SIZE, ENC_TYPE));
raf.write(Helpers.getBytesFromString(album, ALBUM_SIZE, ENC_TYPE));
raf.write(Helpers.getBytesFromString(year, YEAR_SIZE, ENC_TYPE));
raf.write(Helpers.getBytesFromString(comment, COMMENT_SIZE, ENC_TYPE));
raf.write((byte) track);
raf.write((byte) genre);
headerExists = true;
}
|
[
"public",
"void",
"writeTag",
"(",
"RandomAccessFile",
"raf",
")",
"throws",
"FileNotFoundException",
",",
"IOException",
"{",
"if",
"(",
"headerExists",
")",
"raf",
".",
"seek",
"(",
"raf",
".",
"length",
"(",
")",
"-",
"TAG_SIZE",
")",
";",
"else",
"raf",
".",
"seek",
"(",
"raf",
".",
"length",
"(",
")",
")",
";",
"raf",
".",
"write",
"(",
"Helpers",
".",
"getBytesFromString",
"(",
"TAG_START",
",",
"TAG_START",
".",
"length",
"(",
")",
",",
"ENC_TYPE",
")",
")",
";",
"raf",
".",
"write",
"(",
"Helpers",
".",
"getBytesFromString",
"(",
"title",
",",
"TITLE_SIZE",
",",
"ENC_TYPE",
")",
")",
";",
"raf",
".",
"write",
"(",
"Helpers",
".",
"getBytesFromString",
"(",
"artist",
",",
"ARTIST_SIZE",
",",
"ENC_TYPE",
")",
")",
";",
"raf",
".",
"write",
"(",
"Helpers",
".",
"getBytesFromString",
"(",
"album",
",",
"ALBUM_SIZE",
",",
"ENC_TYPE",
")",
")",
";",
"raf",
".",
"write",
"(",
"Helpers",
".",
"getBytesFromString",
"(",
"year",
",",
"YEAR_SIZE",
",",
"ENC_TYPE",
")",
")",
";",
"raf",
".",
"write",
"(",
"Helpers",
".",
"getBytesFromString",
"(",
"comment",
",",
"COMMENT_SIZE",
",",
"ENC_TYPE",
")",
")",
";",
"raf",
".",
"write",
"(",
"(",
"byte",
")",
"track",
")",
";",
"raf",
".",
"write",
"(",
"(",
"byte",
")",
"genre",
")",
";",
"headerExists",
"=",
"true",
";",
"}"
] |
Writes the information in this tag to the file specified in the
constructor. If a tag does not exist, one will be created. If a tag
already exists, it will be overwritten.
@exception FileNotFoundException if an error occurs
@exception IOException if an error occurs
|
[
"Writes",
"the",
"information",
"in",
"this",
"tag",
"to",
"the",
"file",
"specified",
"in",
"the",
"constructor",
".",
"If",
"a",
"tag",
"does",
"not",
"exist",
"one",
"will",
"be",
"created",
".",
"If",
"a",
"tag",
"already",
"exists",
"it",
"will",
"be",
"overwritten",
"."
] |
cda4fe943a589dc49415f4413453e2eece72076a
|
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/javamod/multimedia/mp3/id3/ID3v1Tag.java#L160-L177
|
150,614
|
jtrfp/javamod
|
src/main/java/de/quippy/javamod/multimedia/mp3/id3/ID3v1Tag.java
|
ID3v1Tag.removeTag
|
public void removeTag(RandomAccessFile raf) throws FileNotFoundException, IOException
{
if (headerExists)
{
raf.setLength(raf.length() - TAG_SIZE);
headerExists = false;
}
}
|
java
|
public void removeTag(RandomAccessFile raf) throws FileNotFoundException, IOException
{
if (headerExists)
{
raf.setLength(raf.length() - TAG_SIZE);
headerExists = false;
}
}
|
[
"public",
"void",
"removeTag",
"(",
"RandomAccessFile",
"raf",
")",
"throws",
"FileNotFoundException",
",",
"IOException",
"{",
"if",
"(",
"headerExists",
")",
"{",
"raf",
".",
"setLength",
"(",
"raf",
".",
"length",
"(",
")",
"-",
"TAG_SIZE",
")",
";",
"headerExists",
"=",
"false",
";",
"}",
"}"
] |
Removes the id3v1 tag from the file specified in the constructor
by reducing the file size
@return true if the tag was removed successfully
@exception FileNotFoundException if an error occurs
@exception IOException if an error occurs
|
[
"Removes",
"the",
"id3v1",
"tag",
"from",
"the",
"file",
"specified",
"in",
"the",
"constructor",
"by",
"reducing",
"the",
"file",
"size"
] |
cda4fe943a589dc49415f4413453e2eece72076a
|
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/javamod/multimedia/mp3/id3/ID3v1Tag.java#L186-L193
|
150,615
|
jtrfp/javamod
|
src/main/java/de/quippy/javamod/multimedia/mp3/id3/ID3v1Tag.java
|
ID3v1Tag.setTitle
|
public void setTitle(String newTitle)
{
if (newTitle.length() > TITLE_SIZE)
{
title = newTitle.substring(0, TITLE_SIZE);
}
else
{
title = newTitle;
}
}
|
java
|
public void setTitle(String newTitle)
{
if (newTitle.length() > TITLE_SIZE)
{
title = newTitle.substring(0, TITLE_SIZE);
}
else
{
title = newTitle;
}
}
|
[
"public",
"void",
"setTitle",
"(",
"String",
"newTitle",
")",
"{",
"if",
"(",
"newTitle",
".",
"length",
"(",
")",
">",
"TITLE_SIZE",
")",
"{",
"title",
"=",
"newTitle",
".",
"substring",
"(",
"0",
",",
"TITLE_SIZE",
")",
";",
"}",
"else",
"{",
"title",
"=",
"newTitle",
";",
"}",
"}"
] |
Set the title field of the tag. The maximum size of the String is 30.
If the size exceeds the maximum size, the String will be truncated.
@param newTitle the title for the tag
|
[
"Set",
"the",
"title",
"field",
"of",
"the",
"tag",
".",
"The",
"maximum",
"size",
"of",
"the",
"String",
"is",
"30",
".",
"If",
"the",
"size",
"exceeds",
"the",
"maximum",
"size",
"the",
"String",
"will",
"be",
"truncated",
"."
] |
cda4fe943a589dc49415f4413453e2eece72076a
|
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/javamod/multimedia/mp3/id3/ID3v1Tag.java#L254-L264
|
150,616
|
jtrfp/javamod
|
src/main/java/de/quippy/javamod/multimedia/mp3/id3/ID3v1Tag.java
|
ID3v1Tag.setArtist
|
public void setArtist(String newArtist)
{
if (newArtist.length() > ARTIST_SIZE)
{
artist = newArtist.substring(0, ARTIST_SIZE);
}
else
{
artist = newArtist;
}
}
|
java
|
public void setArtist(String newArtist)
{
if (newArtist.length() > ARTIST_SIZE)
{
artist = newArtist.substring(0, ARTIST_SIZE);
}
else
{
artist = newArtist;
}
}
|
[
"public",
"void",
"setArtist",
"(",
"String",
"newArtist",
")",
"{",
"if",
"(",
"newArtist",
".",
"length",
"(",
")",
">",
"ARTIST_SIZE",
")",
"{",
"artist",
"=",
"newArtist",
".",
"substring",
"(",
"0",
",",
"ARTIST_SIZE",
")",
";",
"}",
"else",
"{",
"artist",
"=",
"newArtist",
";",
"}",
"}"
] |
Set the artist field of the tag. The maximum size of the String is 30.
If the size exceeds the maximum size, the String will be truncated.
@param newArtist the artist for the tag
|
[
"Set",
"the",
"artist",
"field",
"of",
"the",
"tag",
".",
"The",
"maximum",
"size",
"of",
"the",
"String",
"is",
"30",
".",
"If",
"the",
"size",
"exceeds",
"the",
"maximum",
"size",
"the",
"String",
"will",
"be",
"truncated",
"."
] |
cda4fe943a589dc49415f4413453e2eece72076a
|
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/javamod/multimedia/mp3/id3/ID3v1Tag.java#L282-L292
|
150,617
|
jtrfp/javamod
|
src/main/java/de/quippy/javamod/multimedia/mp3/id3/ID3v1Tag.java
|
ID3v1Tag.setAlbum
|
public void setAlbum(String newAlbum)
{
if (newAlbum.length() > ALBUM_SIZE)
{
album = newAlbum.substring(0, ALBUM_SIZE);
}
else
{
album = newAlbum;
}
}
|
java
|
public void setAlbum(String newAlbum)
{
if (newAlbum.length() > ALBUM_SIZE)
{
album = newAlbum.substring(0, ALBUM_SIZE);
}
else
{
album = newAlbum;
}
}
|
[
"public",
"void",
"setAlbum",
"(",
"String",
"newAlbum",
")",
"{",
"if",
"(",
"newAlbum",
".",
"length",
"(",
")",
">",
"ALBUM_SIZE",
")",
"{",
"album",
"=",
"newAlbum",
".",
"substring",
"(",
"0",
",",
"ALBUM_SIZE",
")",
";",
"}",
"else",
"{",
"album",
"=",
"newAlbum",
";",
"}",
"}"
] |
Set the album field of the tag. The maximum size of the String is 30.
If the size exceeds the maximum size, the String will be truncated.
@param newAlbum the album for the tag
|
[
"Set",
"the",
"album",
"field",
"of",
"the",
"tag",
".",
"The",
"maximum",
"size",
"of",
"the",
"String",
"is",
"30",
".",
"If",
"the",
"size",
"exceeds",
"the",
"maximum",
"size",
"the",
"String",
"will",
"be",
"truncated",
"."
] |
cda4fe943a589dc49415f4413453e2eece72076a
|
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/javamod/multimedia/mp3/id3/ID3v1Tag.java#L310-L320
|
150,618
|
jtrfp/javamod
|
src/main/java/de/quippy/javamod/multimedia/mp3/id3/ID3v1Tag.java
|
ID3v1Tag.setYear
|
public void setYear(String newYear)
{
if (newYear.length() > YEAR_SIZE)
{
year = newYear.substring(0, YEAR_SIZE);
}
else
{
year = newYear;
}
}
|
java
|
public void setYear(String newYear)
{
if (newYear.length() > YEAR_SIZE)
{
year = newYear.substring(0, YEAR_SIZE);
}
else
{
year = newYear;
}
}
|
[
"public",
"void",
"setYear",
"(",
"String",
"newYear",
")",
"{",
"if",
"(",
"newYear",
".",
"length",
"(",
")",
">",
"YEAR_SIZE",
")",
"{",
"year",
"=",
"newYear",
".",
"substring",
"(",
"0",
",",
"YEAR_SIZE",
")",
";",
"}",
"else",
"{",
"year",
"=",
"newYear",
";",
"}",
"}"
] |
Set the year field of the tag. The maximum size of the String is 4.
If the size exceeds the maximum size, the String will be truncated.
@param newYear the year for the tag
|
[
"Set",
"the",
"year",
"field",
"of",
"the",
"tag",
".",
"The",
"maximum",
"size",
"of",
"the",
"String",
"is",
"4",
".",
"If",
"the",
"size",
"exceeds",
"the",
"maximum",
"size",
"the",
"String",
"will",
"be",
"truncated",
"."
] |
cda4fe943a589dc49415f4413453e2eece72076a
|
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/javamod/multimedia/mp3/id3/ID3v1Tag.java#L338-L348
|
150,619
|
jtrfp/javamod
|
src/main/java/de/quippy/javamod/multimedia/mp3/id3/ID3v1Tag.java
|
ID3v1Tag.setComment
|
public void setComment(String newComment)
{
if (comment.length() > COMMENT_SIZE)
{
comment = newComment.substring(0, COMMENT_SIZE);
}
else
{
comment = newComment;
}
}
|
java
|
public void setComment(String newComment)
{
if (comment.length() > COMMENT_SIZE)
{
comment = newComment.substring(0, COMMENT_SIZE);
}
else
{
comment = newComment;
}
}
|
[
"public",
"void",
"setComment",
"(",
"String",
"newComment",
")",
"{",
"if",
"(",
"comment",
".",
"length",
"(",
")",
">",
"COMMENT_SIZE",
")",
"{",
"comment",
"=",
"newComment",
".",
"substring",
"(",
"0",
",",
"COMMENT_SIZE",
")",
";",
"}",
"else",
"{",
"comment",
"=",
"newComment",
";",
"}",
"}"
] |
Set the comment field of the tag. The maximum size of the String is 30.
If the size exceeds the maximum size, the String will be truncated.
@param newComment the comment of the tag
|
[
"Set",
"the",
"comment",
"field",
"of",
"the",
"tag",
".",
"The",
"maximum",
"size",
"of",
"the",
"String",
"is",
"30",
".",
"If",
"the",
"size",
"exceeds",
"the",
"maximum",
"size",
"the",
"String",
"will",
"be",
"truncated",
"."
] |
cda4fe943a589dc49415f4413453e2eece72076a
|
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/javamod/multimedia/mp3/id3/ID3v1Tag.java#L366-L376
|
150,620
|
jtrfp/javamod
|
src/main/java/de/quippy/jflac/frame/EntropyPartitionedRiceContents.java
|
EntropyPartitionedRiceContents.ensureSize
|
public void ensureSize(int maxPartitionOrder) {
if (capacityByOrder >= maxPartitionOrder) return;
parameters = new int[(1 << maxPartitionOrder)];
rawBits = new int[(1 << maxPartitionOrder)];
capacityByOrder = maxPartitionOrder;
}
|
java
|
public void ensureSize(int maxPartitionOrder) {
if (capacityByOrder >= maxPartitionOrder) return;
parameters = new int[(1 << maxPartitionOrder)];
rawBits = new int[(1 << maxPartitionOrder)];
capacityByOrder = maxPartitionOrder;
}
|
[
"public",
"void",
"ensureSize",
"(",
"int",
"maxPartitionOrder",
")",
"{",
"if",
"(",
"capacityByOrder",
">=",
"maxPartitionOrder",
")",
"return",
";",
"parameters",
"=",
"new",
"int",
"[",
"(",
"1",
"<<",
"maxPartitionOrder",
")",
"]",
";",
"rawBits",
"=",
"new",
"int",
"[",
"(",
"1",
"<<",
"maxPartitionOrder",
")",
"]",
";",
"capacityByOrder",
"=",
"maxPartitionOrder",
";",
"}"
] |
Ensure enough menory has been allocated.
@param maxPartitionOrder The maximum partition order
|
[
"Ensure",
"enough",
"menory",
"has",
"been",
"allocated",
"."
] |
cda4fe943a589dc49415f4413453e2eece72076a
|
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/jflac/frame/EntropyPartitionedRiceContents.java#L38-L43
|
150,621
|
rwl/CSparseJ
|
src/main/java/edu/emory/mathcs/csparsej/tfloat/Scs_lusol.java
|
Scs_lusol.cs_lusol
|
public static boolean cs_lusol(int order, Scs A, float[] b, float tol) {
float[] x;
Scss S;
Scsn N;
int n;
boolean ok;
if (!Scs_util.CS_CSC(A) || b == null)
return (false); /* check inputs */
n = A.n;
S = Scs_sqr.cs_sqr(order, A, false); /* ordering and symbolic analysis */
N = Scs_lu.cs_lu(A, S, tol); /* numeric LU factorization */
x = new float[n]; /* get workspace */
ok = (S != null && N != null);
if (ok) {
Scs_ipvec.cs_ipvec(N.pinv, b, x, n); /* x = b(p) */
Scs_lsolve.cs_lsolve(N.L, x); /* x = L\x */
Scs_usolve.cs_usolve(N.U, x); /* x = U\x */
Scs_ipvec.cs_ipvec(S.q, x, b, n); /* b(q) = x */
}
return (ok);
}
|
java
|
public static boolean cs_lusol(int order, Scs A, float[] b, float tol) {
float[] x;
Scss S;
Scsn N;
int n;
boolean ok;
if (!Scs_util.CS_CSC(A) || b == null)
return (false); /* check inputs */
n = A.n;
S = Scs_sqr.cs_sqr(order, A, false); /* ordering and symbolic analysis */
N = Scs_lu.cs_lu(A, S, tol); /* numeric LU factorization */
x = new float[n]; /* get workspace */
ok = (S != null && N != null);
if (ok) {
Scs_ipvec.cs_ipvec(N.pinv, b, x, n); /* x = b(p) */
Scs_lsolve.cs_lsolve(N.L, x); /* x = L\x */
Scs_usolve.cs_usolve(N.U, x); /* x = U\x */
Scs_ipvec.cs_ipvec(S.q, x, b, n); /* b(q) = x */
}
return (ok);
}
|
[
"public",
"static",
"boolean",
"cs_lusol",
"(",
"int",
"order",
",",
"Scs",
"A",
",",
"float",
"[",
"]",
"b",
",",
"float",
"tol",
")",
"{",
"float",
"[",
"]",
"x",
";",
"Scss",
"S",
";",
"Scsn",
"N",
";",
"int",
"n",
";",
"boolean",
"ok",
";",
"if",
"(",
"!",
"Scs_util",
".",
"CS_CSC",
"(",
"A",
")",
"||",
"b",
"==",
"null",
")",
"return",
"(",
"false",
")",
";",
"/* check inputs */",
"n",
"=",
"A",
".",
"n",
";",
"S",
"=",
"Scs_sqr",
".",
"cs_sqr",
"(",
"order",
",",
"A",
",",
"false",
")",
";",
"/* ordering and symbolic analysis */",
"N",
"=",
"Scs_lu",
".",
"cs_lu",
"(",
"A",
",",
"S",
",",
"tol",
")",
";",
"/* numeric LU factorization */",
"x",
"=",
"new",
"float",
"[",
"n",
"]",
";",
"/* get workspace */",
"ok",
"=",
"(",
"S",
"!=",
"null",
"&&",
"N",
"!=",
"null",
")",
";",
"if",
"(",
"ok",
")",
"{",
"Scs_ipvec",
".",
"cs_ipvec",
"(",
"N",
".",
"pinv",
",",
"b",
",",
"x",
",",
"n",
")",
";",
"/* x = b(p) */",
"Scs_lsolve",
".",
"cs_lsolve",
"(",
"N",
".",
"L",
",",
"x",
")",
";",
"/* x = L\\x */",
"Scs_usolve",
".",
"cs_usolve",
"(",
"N",
".",
"U",
",",
"x",
")",
";",
"/* x = U\\x */",
"Scs_ipvec",
".",
"cs_ipvec",
"(",
"S",
".",
"q",
",",
"x",
",",
"b",
",",
"n",
")",
";",
"/* b(q) = x */",
"}",
"return",
"(",
"ok",
")",
";",
"}"
] |
Solves Ax=b, where A is square and nonsingular. b overwritten with
solution. Partial pivoting if tol = 1.f
@param order
ordering method to use (0 to 3)
@param A
column-compressed matrix
@param b
size n, b on input, x on output
@param tol
partial pivoting tolerance
@return true if successful, false on error
|
[
"Solves",
"Ax",
"=",
"b",
"where",
"A",
"is",
"square",
"and",
"nonsingular",
".",
"b",
"overwritten",
"with",
"solution",
".",
"Partial",
"pivoting",
"if",
"tol",
"=",
"1",
".",
"f"
] |
6a6f66bccce1558156a961494358952603b0ac84
|
https://github.com/rwl/CSparseJ/blob/6a6f66bccce1558156a961494358952603b0ac84/src/main/java/edu/emory/mathcs/csparsej/tfloat/Scs_lusol.java#L53-L73
|
150,622
|
lecousin/java-framework-core
|
net.lecousin.core/src/main/java/net/lecousin/framework/util/PathPattern.java
|
PathPattern.matches
|
public static boolean matches(Collection<PathPattern> patterns, List<String> path) {
for (PathPattern pattern : patterns)
if (pattern.matches(path))
return true;
return false;
}
|
java
|
public static boolean matches(Collection<PathPattern> patterns, List<String> path) {
for (PathPattern pattern : patterns)
if (pattern.matches(path))
return true;
return false;
}
|
[
"public",
"static",
"boolean",
"matches",
"(",
"Collection",
"<",
"PathPattern",
">",
"patterns",
",",
"List",
"<",
"String",
">",
"path",
")",
"{",
"for",
"(",
"PathPattern",
"pattern",
":",
"patterns",
")",
"if",
"(",
"pattern",
".",
"matches",
"(",
"path",
")",
")",
"return",
"true",
";",
"return",
"false",
";",
"}"
] |
Return true if the given path elements match at least one of the given pattern.
|
[
"Return",
"true",
"if",
"the",
"given",
"path",
"elements",
"match",
"at",
"least",
"one",
"of",
"the",
"given",
"pattern",
"."
] |
b0c893b44bfde2c03f90ea846a49ef5749d598f3
|
https://github.com/lecousin/java-framework-core/blob/b0c893b44bfde2c03f90ea846a49ef5749d598f3/net.lecousin.core/src/main/java/net/lecousin/framework/util/PathPattern.java#L103-L108
|
150,623
|
lecousin/java-framework-core
|
net.lecousin.core/src/main/java/net/lecousin/framework/io/IOAsOutputStream.java
|
IOAsOutputStream.get
|
public static OutputStream get(IO.Writable io) {
if (io instanceof IOFromOutputStream)
return ((IOFromOutputStream)io).getOutputStream();
if (io instanceof IO.WritableByteStream)
return new ByteStream((IO.WritableByteStream)io);
return new Writable(io);
}
|
java
|
public static OutputStream get(IO.Writable io) {
if (io instanceof IOFromOutputStream)
return ((IOFromOutputStream)io).getOutputStream();
if (io instanceof IO.WritableByteStream)
return new ByteStream((IO.WritableByteStream)io);
return new Writable(io);
}
|
[
"public",
"static",
"OutputStream",
"get",
"(",
"IO",
".",
"Writable",
"io",
")",
"{",
"if",
"(",
"io",
"instanceof",
"IOFromOutputStream",
")",
"return",
"(",
"(",
"IOFromOutputStream",
")",
"io",
")",
".",
"getOutputStream",
"(",
")",
";",
"if",
"(",
"io",
"instanceof",
"IO",
".",
"WritableByteStream",
")",
"return",
"new",
"ByteStream",
"(",
"(",
"IO",
".",
"WritableByteStream",
")",
"io",
")",
";",
"return",
"new",
"Writable",
"(",
"io",
")",
";",
"}"
] |
Create an OutputStream based on the given writable IO.
|
[
"Create",
"an",
"OutputStream",
"based",
"on",
"the",
"given",
"writable",
"IO",
"."
] |
b0c893b44bfde2c03f90ea846a49ef5749d598f3
|
https://github.com/lecousin/java-framework-core/blob/b0c893b44bfde2c03f90ea846a49ef5749d598f3/net.lecousin.core/src/main/java/net/lecousin/framework/io/IOAsOutputStream.java#L13-L19
|
150,624
|
livetribe/livetribe-slp
|
osgi/bundle/src/main/java/org/livetribe/slp/osgi/ServiceAgentManagedService.java
|
ServiceAgentManagedService.close
|
public void close()
{
LOGGER.entering(CLASS_NAME, "close");
synchronized (lock)
{
if (serviceAgent != null)
{
serviceRegistration.unregister();
if (LOGGER.isLoggable(Level.FINER)) LOGGER.finer("Service Agent " + this + " stopping...");
serviceAgent.stop();
if (LOGGER.isLoggable(Level.FINE)) LOGGER.fine("Service Agent " + this + " stopped successfully");
}
}
LOGGER.exiting(CLASS_NAME, "close");
}
|
java
|
public void close()
{
LOGGER.entering(CLASS_NAME, "close");
synchronized (lock)
{
if (serviceAgent != null)
{
serviceRegistration.unregister();
if (LOGGER.isLoggable(Level.FINER)) LOGGER.finer("Service Agent " + this + " stopping...");
serviceAgent.stop();
if (LOGGER.isLoggable(Level.FINE)) LOGGER.fine("Service Agent " + this + " stopped successfully");
}
}
LOGGER.exiting(CLASS_NAME, "close");
}
|
[
"public",
"void",
"close",
"(",
")",
"{",
"LOGGER",
".",
"entering",
"(",
"CLASS_NAME",
",",
"\"close\"",
")",
";",
"synchronized",
"(",
"lock",
")",
"{",
"if",
"(",
"serviceAgent",
"!=",
"null",
")",
"{",
"serviceRegistration",
".",
"unregister",
"(",
")",
";",
"if",
"(",
"LOGGER",
".",
"isLoggable",
"(",
"Level",
".",
"FINER",
")",
")",
"LOGGER",
".",
"finer",
"(",
"\"Service Agent \"",
"+",
"this",
"+",
"\" stopping...\"",
")",
";",
"serviceAgent",
".",
"stop",
"(",
")",
";",
"if",
"(",
"LOGGER",
".",
"isLoggable",
"(",
"Level",
".",
"FINE",
")",
")",
"LOGGER",
".",
"fine",
"(",
"\"Service Agent \"",
"+",
"this",
"+",
"\" stopped successfully\"",
")",
";",
"}",
"}",
"LOGGER",
".",
"exiting",
"(",
"CLASS_NAME",
",",
"\"close\"",
")",
";",
"}"
] |
Shuts down the user agent if one exists.
|
[
"Shuts",
"down",
"the",
"user",
"agent",
"if",
"one",
"exists",
"."
] |
6cc13dbe81feab133fe3dd291ca081cbc6e1f591
|
https://github.com/livetribe/livetribe-slp/blob/6cc13dbe81feab133fe3dd291ca081cbc6e1f591/osgi/bundle/src/main/java/org/livetribe/slp/osgi/ServiceAgentManagedService.java#L131-L150
|
150,625
|
hawkular/hawkular-inventory
|
hawkular-inventory-impl-tinkerpop-parent/hawkular-inventory-impl-tinkerpop/src/main/java/org/hawkular/inventory/impl/tinkerpop/TinkerpopBackend.java
|
TinkerpopBackend.checkProperties
|
static void checkProperties(Map<String, Object> properties, String[] disallowedProperties) {
if (properties == null || properties.isEmpty()) {
return;
}
HashSet<String> disallowed = new HashSet<>(properties.keySet());
disallowed.retainAll(Arrays.asList(disallowedProperties));
if (!disallowed.isEmpty()) {
throw new IllegalArgumentException("The following properties are reserved for this type of entity: "
+ Arrays.asList(disallowedProperties));
}
}
|
java
|
static void checkProperties(Map<String, Object> properties, String[] disallowedProperties) {
if (properties == null || properties.isEmpty()) {
return;
}
HashSet<String> disallowed = new HashSet<>(properties.keySet());
disallowed.retainAll(Arrays.asList(disallowedProperties));
if (!disallowed.isEmpty()) {
throw new IllegalArgumentException("The following properties are reserved for this type of entity: "
+ Arrays.asList(disallowedProperties));
}
}
|
[
"static",
"void",
"checkProperties",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"properties",
",",
"String",
"[",
"]",
"disallowedProperties",
")",
"{",
"if",
"(",
"properties",
"==",
"null",
"||",
"properties",
".",
"isEmpty",
"(",
")",
")",
"{",
"return",
";",
"}",
"HashSet",
"<",
"String",
">",
"disallowed",
"=",
"new",
"HashSet",
"<>",
"(",
"properties",
".",
"keySet",
"(",
")",
")",
";",
"disallowed",
".",
"retainAll",
"(",
"Arrays",
".",
"asList",
"(",
"disallowedProperties",
")",
")",
";",
"if",
"(",
"!",
"disallowed",
".",
"isEmpty",
"(",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"The following properties are reserved for this type of entity: \"",
"+",
"Arrays",
".",
"asList",
"(",
"disallowedProperties",
")",
")",
";",
"}",
"}"
] |
If the properties map contains a key from the disallowed properties, throw an exception.
@param properties the properties to check
@param disallowedProperties the list of property names that cannot appear in the provided map
@throws IllegalArgumentException if the map contains one or more disallowed keys
|
[
"If",
"the",
"properties",
"map",
"contains",
"a",
"key",
"from",
"the",
"disallowed",
"properties",
"throw",
"an",
"exception",
"."
] |
f56dc10323dca21777feb5b609a9e9cc70ffaf62
|
https://github.com/hawkular/hawkular-inventory/blob/f56dc10323dca21777feb5b609a9e9cc70ffaf62/hawkular-inventory-impl-tinkerpop-parent/hawkular-inventory-impl-tinkerpop/src/main/java/org/hawkular/inventory/impl/tinkerpop/TinkerpopBackend.java#L1268-L1280
|
150,626
|
hawkular/hawkular-inventory
|
hawkular-inventory-impl-tinkerpop-parent/hawkular-inventory-impl-tinkerpop/src/main/java/org/hawkular/inventory/impl/tinkerpop/TinkerpopBackend.java
|
TinkerpopBackend.updateProperties
|
static void updateProperties(Element e, Map<String, Object> properties, String[] disallowedProperties) {
if (properties == null) {
return;
}
Set<String> disallowed = new HashSet<>(Arrays.asList(disallowedProperties));
//remove all non-mapped properties, that are not in the update
Spliterator<Property<?>> sp = Spliterators.spliteratorUnknownSize(e.properties(),
Spliterator.NONNULL & Spliterator.IMMUTABLE);
Property<?>[] toRemove = StreamSupport.stream(sp, false)
.filter((p) -> !disallowed.contains(p.key()) && !properties.containsKey(p.key()))
.toArray(Property[]::new);
for (Property<?> p : toRemove) {
p.remove();
}
//update and add new the properties
properties.forEach((p, v) -> {
if (!disallowed.contains(p)) {
e.property(p, v);
}
});
}
|
java
|
static void updateProperties(Element e, Map<String, Object> properties, String[] disallowedProperties) {
if (properties == null) {
return;
}
Set<String> disallowed = new HashSet<>(Arrays.asList(disallowedProperties));
//remove all non-mapped properties, that are not in the update
Spliterator<Property<?>> sp = Spliterators.spliteratorUnknownSize(e.properties(),
Spliterator.NONNULL & Spliterator.IMMUTABLE);
Property<?>[] toRemove = StreamSupport.stream(sp, false)
.filter((p) -> !disallowed.contains(p.key()) && !properties.containsKey(p.key()))
.toArray(Property[]::new);
for (Property<?> p : toRemove) {
p.remove();
}
//update and add new the properties
properties.forEach((p, v) -> {
if (!disallowed.contains(p)) {
e.property(p, v);
}
});
}
|
[
"static",
"void",
"updateProperties",
"(",
"Element",
"e",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"properties",
",",
"String",
"[",
"]",
"disallowedProperties",
")",
"{",
"if",
"(",
"properties",
"==",
"null",
")",
"{",
"return",
";",
"}",
"Set",
"<",
"String",
">",
"disallowed",
"=",
"new",
"HashSet",
"<>",
"(",
"Arrays",
".",
"asList",
"(",
"disallowedProperties",
")",
")",
";",
"//remove all non-mapped properties, that are not in the update",
"Spliterator",
"<",
"Property",
"<",
"?",
">",
">",
"sp",
"=",
"Spliterators",
".",
"spliteratorUnknownSize",
"(",
"e",
".",
"properties",
"(",
")",
",",
"Spliterator",
".",
"NONNULL",
"&",
"Spliterator",
".",
"IMMUTABLE",
")",
";",
"Property",
"<",
"?",
">",
"[",
"]",
"toRemove",
"=",
"StreamSupport",
".",
"stream",
"(",
"sp",
",",
"false",
")",
".",
"filter",
"(",
"(",
"p",
")",
"-",
">",
"!",
"disallowed",
".",
"contains",
"(",
"p",
".",
"key",
"(",
")",
")",
"&&",
"!",
"properties",
".",
"containsKey",
"(",
"p",
".",
"key",
"(",
")",
")",
")",
".",
"toArray",
"(",
"Property",
"[",
"]",
"::",
"new",
")",
";",
"for",
"(",
"Property",
"<",
"?",
">",
"p",
":",
"toRemove",
")",
"{",
"p",
".",
"remove",
"(",
")",
";",
"}",
"//update and add new the properties",
"properties",
".",
"forEach",
"(",
"(",
"p",
",",
"v",
")",
"->",
"{",
"if",
"(",
"!",
"disallowed",
".",
"contains",
"(",
"p",
")",
")",
"{",
"e",
".",
"property",
"(",
"p",
",",
"v",
")",
";",
"}",
"}",
")",
";",
"}"
] |
Updates the properties of the element, disregarding any changes of the disallowed properties
<p> The list of the disallowed properties will usually come from
{@link Constants.Type#getMappedProperties()}.
@param e the element to update properties of
@param properties the properties to update
@param disallowedProperties the list of properties that are not allowed to change.
|
[
"Updates",
"the",
"properties",
"of",
"the",
"element",
"disregarding",
"any",
"changes",
"of",
"the",
"disallowed",
"properties"
] |
f56dc10323dca21777feb5b609a9e9cc70ffaf62
|
https://github.com/hawkular/hawkular-inventory/blob/f56dc10323dca21777feb5b609a9e9cc70ffaf62/hawkular-inventory-impl-tinkerpop-parent/hawkular-inventory-impl-tinkerpop/src/main/java/org/hawkular/inventory/impl/tinkerpop/TinkerpopBackend.java#L1292-L1316
|
150,627
|
hawkular/hawkular-inventory
|
hawkular-inventory-impl-tinkerpop-parent/hawkular-inventory-impl-tinkerpop/src/main/java/org/hawkular/inventory/impl/tinkerpop/TinkerpopBackend.java
|
TinkerpopBackend.getType
|
static Constants.Type getType(Vertex v) {
return Constants.Type.valueOf((String) v.property(__type.name()).value());
}
|
java
|
static Constants.Type getType(Vertex v) {
return Constants.Type.valueOf((String) v.property(__type.name()).value());
}
|
[
"static",
"Constants",
".",
"Type",
"getType",
"(",
"Vertex",
"v",
")",
"{",
"return",
"Constants",
".",
"Type",
".",
"valueOf",
"(",
"(",
"String",
")",
"v",
".",
"property",
"(",
"__type",
".",
"name",
"(",
")",
")",
".",
"value",
"(",
")",
")",
";",
"}"
] |
Gets the type of the entity that the provided vertex represents.
|
[
"Gets",
"the",
"type",
"of",
"the",
"entity",
"that",
"the",
"provided",
"vertex",
"represents",
"."
] |
f56dc10323dca21777feb5b609a9e9cc70ffaf62
|
https://github.com/hawkular/hawkular-inventory/blob/f56dc10323dca21777feb5b609a9e9cc70ffaf62/hawkular-inventory-impl-tinkerpop-parent/hawkular-inventory-impl-tinkerpop/src/main/java/org/hawkular/inventory/impl/tinkerpop/TinkerpopBackend.java#L1321-L1323
|
150,628
|
WinRoad-NET/wrdocletbase
|
src/main/java/net/winroad/wrdoclet/utils/UniversalNamespaceCache.java
|
UniversalNamespaceCache.examineNode
|
private void examineNode(Node node, boolean attributesOnly) {
while(node != null && node.getNodeType() == Node.COMMENT_NODE) {
node = node.getNextSibling();
}
if(node != null) {
NamedNodeMap attributes = node.getAttributes();
if(attributes != null) {
for (int i = 0; i < attributes.getLength(); i++) {
Node attribute = attributes.item(i);
storeAttribute((Attr) attribute);
}
}
if (!attributesOnly) {
NodeList chields = node.getChildNodes();
for (int i = 0; i < chields.getLength(); i++) {
Node chield = chields.item(i);
if (chield.getNodeType() == Node.ELEMENT_NODE)
examineNode(chield, false);
}
}
}
}
|
java
|
private void examineNode(Node node, boolean attributesOnly) {
while(node != null && node.getNodeType() == Node.COMMENT_NODE) {
node = node.getNextSibling();
}
if(node != null) {
NamedNodeMap attributes = node.getAttributes();
if(attributes != null) {
for (int i = 0; i < attributes.getLength(); i++) {
Node attribute = attributes.item(i);
storeAttribute((Attr) attribute);
}
}
if (!attributesOnly) {
NodeList chields = node.getChildNodes();
for (int i = 0; i < chields.getLength(); i++) {
Node chield = chields.item(i);
if (chield.getNodeType() == Node.ELEMENT_NODE)
examineNode(chield, false);
}
}
}
}
|
[
"private",
"void",
"examineNode",
"(",
"Node",
"node",
",",
"boolean",
"attributesOnly",
")",
"{",
"while",
"(",
"node",
"!=",
"null",
"&&",
"node",
".",
"getNodeType",
"(",
")",
"==",
"Node",
".",
"COMMENT_NODE",
")",
"{",
"node",
"=",
"node",
".",
"getNextSibling",
"(",
")",
";",
"}",
"if",
"(",
"node",
"!=",
"null",
")",
"{",
"NamedNodeMap",
"attributes",
"=",
"node",
".",
"getAttributes",
"(",
")",
";",
"if",
"(",
"attributes",
"!=",
"null",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"attributes",
".",
"getLength",
"(",
")",
";",
"i",
"++",
")",
"{",
"Node",
"attribute",
"=",
"attributes",
".",
"item",
"(",
"i",
")",
";",
"storeAttribute",
"(",
"(",
"Attr",
")",
"attribute",
")",
";",
"}",
"}",
"if",
"(",
"!",
"attributesOnly",
")",
"{",
"NodeList",
"chields",
"=",
"node",
".",
"getChildNodes",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"chields",
".",
"getLength",
"(",
")",
";",
"i",
"++",
")",
"{",
"Node",
"chield",
"=",
"chields",
".",
"item",
"(",
"i",
")",
";",
"if",
"(",
"chield",
".",
"getNodeType",
"(",
")",
"==",
"Node",
".",
"ELEMENT_NODE",
")",
"examineNode",
"(",
"chield",
",",
"false",
")",
";",
"}",
"}",
"}",
"}"
] |
A single node is read, the namespace attributes are extracted and stored.
@param node
to examine
@param attributesOnly,
if true no recursion happens
|
[
"A",
"single",
"node",
"is",
"read",
"the",
"namespace",
"attributes",
"are",
"extracted",
"and",
"stored",
"."
] |
3c8386a7957a76c3f10a07d114052158976e22c7
|
https://github.com/WinRoad-NET/wrdocletbase/blob/3c8386a7957a76c3f10a07d114052158976e22c7/src/main/java/net/winroad/wrdoclet/utils/UniversalNamespaceCache.java#L47-L69
|
150,629
|
jpaoletti/java-presentation-manager
|
modules/jpm-struts1/src/main/java/jpaoletti/jpm/struts/converter/CollectionConverter.java
|
CollectionConverter.getEntity
|
protected Entity getEntity() throws ConverterException {
final String _entity = getConfig("entity");
if (_entity == null) {
throw new ConverterException("collection.converter.entity.cannot.be.null");
}
final Entity entity = PresentationManager.getPm().getEntity(_entity);
if (entity == null) {
throw new ConverterException("collection.converter.entity.cannot.be.null");
}
return entity;
}
|
java
|
protected Entity getEntity() throws ConverterException {
final String _entity = getConfig("entity");
if (_entity == null) {
throw new ConverterException("collection.converter.entity.cannot.be.null");
}
final Entity entity = PresentationManager.getPm().getEntity(_entity);
if (entity == null) {
throw new ConverterException("collection.converter.entity.cannot.be.null");
}
return entity;
}
|
[
"protected",
"Entity",
"getEntity",
"(",
")",
"throws",
"ConverterException",
"{",
"final",
"String",
"_entity",
"=",
"getConfig",
"(",
"\"entity\"",
")",
";",
"if",
"(",
"_entity",
"==",
"null",
")",
"{",
"throw",
"new",
"ConverterException",
"(",
"\"collection.converter.entity.cannot.be.null\"",
")",
";",
"}",
"final",
"Entity",
"entity",
"=",
"PresentationManager",
".",
"getPm",
"(",
")",
".",
"getEntity",
"(",
"_entity",
")",
";",
"if",
"(",
"entity",
"==",
"null",
")",
"{",
"throw",
"new",
"ConverterException",
"(",
"\"collection.converter.entity.cannot.be.null\"",
")",
";",
"}",
"return",
"entity",
";",
"}"
] |
Getter for entity property. Must be defined.
@return the entity
|
[
"Getter",
"for",
"entity",
"property",
".",
"Must",
"be",
"defined",
"."
] |
d5aab55638383695db244744b4bfe27c5200e04f
|
https://github.com/jpaoletti/java-presentation-manager/blob/d5aab55638383695db244744b4bfe27c5200e04f/modules/jpm-struts1/src/main/java/jpaoletti/jpm/struts/converter/CollectionConverter.java#L100-L110
|
150,630
|
mgledi/DRUMS
|
src/main/java/com/unister/semweb/drums/storable/GeneralStorable.java
|
GeneralStorable.getValueAsFloat
|
public float getValueAsFloat(String field) throws IOException {
int hash = Arrays.hashCode(field.getBytes());
return getValueAsFloat(structure.valueHash2Index.get(hash));
}
|
java
|
public float getValueAsFloat(String field) throws IOException {
int hash = Arrays.hashCode(field.getBytes());
return getValueAsFloat(structure.valueHash2Index.get(hash));
}
|
[
"public",
"float",
"getValueAsFloat",
"(",
"String",
"field",
")",
"throws",
"IOException",
"{",
"int",
"hash",
"=",
"Arrays",
".",
"hashCode",
"(",
"field",
".",
"getBytes",
"(",
")",
")",
";",
"return",
"getValueAsFloat",
"(",
"structure",
".",
"valueHash2Index",
".",
"get",
"(",
"hash",
")",
")",
";",
"}"
] |
Returns the value belonging to the given field as int
@param field
the name of the field
@return the requested value
@throws IOException
|
[
"Returns",
"the",
"value",
"belonging",
"to",
"the",
"given",
"field",
"as",
"int"
] |
a670f17a2186c9a15725f26617d77ce8e444e072
|
https://github.com/mgledi/DRUMS/blob/a670f17a2186c9a15725f26617d77ce8e444e072/src/main/java/com/unister/semweb/drums/storable/GeneralStorable.java#L382-L385
|
150,631
|
mgledi/DRUMS
|
src/main/java/com/unister/semweb/drums/storable/GeneralStorable.java
|
GeneralStorable.getValueAsChar
|
public char getValueAsChar(int index) throws IOException {
if (index >= structure.valueSizes.size()) {
throw new IOException("Index " + index + " is out of range.");
}
return Bytes.toChar(value, structure.valueByteOffsets.get(index));
}
|
java
|
public char getValueAsChar(int index) throws IOException {
if (index >= structure.valueSizes.size()) {
throw new IOException("Index " + index + " is out of range.");
}
return Bytes.toChar(value, structure.valueByteOffsets.get(index));
}
|
[
"public",
"char",
"getValueAsChar",
"(",
"int",
"index",
")",
"throws",
"IOException",
"{",
"if",
"(",
"index",
">=",
"structure",
".",
"valueSizes",
".",
"size",
"(",
")",
")",
"{",
"throw",
"new",
"IOException",
"(",
"\"Index \"",
"+",
"index",
"+",
"\" is out of range.\"",
")",
";",
"}",
"return",
"Bytes",
".",
"toChar",
"(",
"value",
",",
"structure",
".",
"valueByteOffsets",
".",
"get",
"(",
"index",
")",
")",
";",
"}"
] |
Returns the value belonging to the given field as char
@param index
the index of the requested field
@return the requested value
@throws IOException
|
[
"Returns",
"the",
"value",
"belonging",
"to",
"the",
"given",
"field",
"as",
"char"
] |
a670f17a2186c9a15725f26617d77ce8e444e072
|
https://github.com/mgledi/DRUMS/blob/a670f17a2186c9a15725f26617d77ce8e444e072/src/main/java/com/unister/semweb/drums/storable/GeneralStorable.java#L466-L471
|
150,632
|
mgledi/DRUMS
|
src/main/java/com/unister/semweb/drums/storable/GeneralStorable.java
|
GeneralStorable.getValueAsByte
|
public byte getValueAsByte(int index) throws IOException {
if (index >= structure.valueSizes.size()) {
throw new IOException("Index " + index + " is out of range.");
}
return value[index];
}
|
java
|
public byte getValueAsByte(int index) throws IOException {
if (index >= structure.valueSizes.size()) {
throw new IOException("Index " + index + " is out of range.");
}
return value[index];
}
|
[
"public",
"byte",
"getValueAsByte",
"(",
"int",
"index",
")",
"throws",
"IOException",
"{",
"if",
"(",
"index",
">=",
"structure",
".",
"valueSizes",
".",
"size",
"(",
")",
")",
"{",
"throw",
"new",
"IOException",
"(",
"\"Index \"",
"+",
"index",
"+",
"\" is out of range.\"",
")",
";",
"}",
"return",
"value",
"[",
"index",
"]",
";",
"}"
] |
Returns the value belonging to the given field as byte
@param index
the index of the requested field
@return the requested value
@throws IOException
|
[
"Returns",
"the",
"value",
"belonging",
"to",
"the",
"given",
"field",
"as",
"byte"
] |
a670f17a2186c9a15725f26617d77ce8e444e072
|
https://github.com/mgledi/DRUMS/blob/a670f17a2186c9a15725f26617d77ce8e444e072/src/main/java/com/unister/semweb/drums/storable/GeneralStorable.java#L507-L512
|
150,633
|
mgledi/DRUMS
|
src/main/java/com/unister/semweb/drums/storable/GeneralStorable.java
|
GeneralStorable.getKeyAsChar
|
public char getKeyAsChar(int index) throws IOException {
if (index >= structure.keySizes.size()) {
throw new IOException("Index " + index + " is out of range.");
}
return Bytes.toChar(key, structure.keyByteOffsets.get(index));
}
|
java
|
public char getKeyAsChar(int index) throws IOException {
if (index >= structure.keySizes.size()) {
throw new IOException("Index " + index + " is out of range.");
}
return Bytes.toChar(key, structure.keyByteOffsets.get(index));
}
|
[
"public",
"char",
"getKeyAsChar",
"(",
"int",
"index",
")",
"throws",
"IOException",
"{",
"if",
"(",
"index",
">=",
"structure",
".",
"keySizes",
".",
"size",
"(",
")",
")",
"{",
"throw",
"new",
"IOException",
"(",
"\"Index \"",
"+",
"index",
"+",
"\" is out of range.\"",
")",
";",
"}",
"return",
"Bytes",
".",
"toChar",
"(",
"key",
",",
"structure",
".",
"keyByteOffsets",
".",
"get",
"(",
"index",
")",
")",
";",
"}"
] |
Returns the key belonging to the given field as char
@param index
the index of the requested field
@return the requested value
@throws IOException
|
[
"Returns",
"the",
"key",
"belonging",
"to",
"the",
"given",
"field",
"as",
"char"
] |
a670f17a2186c9a15725f26617d77ce8e444e072
|
https://github.com/mgledi/DRUMS/blob/a670f17a2186c9a15725f26617d77ce8e444e072/src/main/java/com/unister/semweb/drums/storable/GeneralStorable.java#L898-L904
|
150,634
|
mgledi/DRUMS
|
src/main/java/com/unister/semweb/drums/storable/GeneralStorable.java
|
GeneralStorable.getKeyAsByte
|
public byte getKeyAsByte(int index) throws IOException {
if (index >= structure.keySizes.size()) {
throw new IOException("Index " + index + " is out of range.");
}
return key[structure.keyByteOffsets.get(index)];
}
|
java
|
public byte getKeyAsByte(int index) throws IOException {
if (index >= structure.keySizes.size()) {
throw new IOException("Index " + index + " is out of range.");
}
return key[structure.keyByteOffsets.get(index)];
}
|
[
"public",
"byte",
"getKeyAsByte",
"(",
"int",
"index",
")",
"throws",
"IOException",
"{",
"if",
"(",
"index",
">=",
"structure",
".",
"keySizes",
".",
"size",
"(",
")",
")",
"{",
"throw",
"new",
"IOException",
"(",
"\"Index \"",
"+",
"index",
"+",
"\" is out of range.\"",
")",
";",
"}",
"return",
"key",
"[",
"structure",
".",
"keyByteOffsets",
".",
"get",
"(",
"index",
")",
"]",
";",
"}"
] |
Returns the key belonging to the given field as byte
@param index
the index of the requested field
@return the requested value
@throws IOException
|
[
"Returns",
"the",
"key",
"belonging",
"to",
"the",
"given",
"field",
"as",
"byte"
] |
a670f17a2186c9a15725f26617d77ce8e444e072
|
https://github.com/mgledi/DRUMS/blob/a670f17a2186c9a15725f26617d77ce8e444e072/src/main/java/com/unister/semweb/drums/storable/GeneralStorable.java#L927-L932
|
150,635
|
mgledi/DRUMS
|
src/main/java/com/unister/semweb/drums/sync/synchronizer/Synchronizer.java
|
Synchronizer.writeBuffer
|
private void writeBuffer() throws IOException {
bufferedWriter.flip(); // position is set to zero in dataFile.write
dataFile.write(writeOffset, bufferedWriter);
writeOffset += bufferedWriter.limit();
bufferedWriter.clear();
readNextChunkFromFile(); // before overwriting the next bucket. Read it.
}
|
java
|
private void writeBuffer() throws IOException {
bufferedWriter.flip(); // position is set to zero in dataFile.write
dataFile.write(writeOffset, bufferedWriter);
writeOffset += bufferedWriter.limit();
bufferedWriter.clear();
readNextChunkFromFile(); // before overwriting the next bucket. Read it.
}
|
[
"private",
"void",
"writeBuffer",
"(",
")",
"throws",
"IOException",
"{",
"bufferedWriter",
".",
"flip",
"(",
")",
";",
"// position is set to zero in dataFile.write\r",
"dataFile",
".",
"write",
"(",
"writeOffset",
",",
"bufferedWriter",
")",
";",
"writeOffset",
"+=",
"bufferedWriter",
".",
"limit",
"(",
")",
";",
"bufferedWriter",
".",
"clear",
"(",
")",
";",
"readNextChunkFromFile",
"(",
")",
";",
"// before overwriting the next bucket. Read it.\r",
"}"
] |
writes the remaining bytes in bufferedWriter to the given FileChannel
@param FileChannel
@throws IOException
|
[
"writes",
"the",
"remaining",
"bytes",
"in",
"bufferedWriter",
"to",
"the",
"given",
"FileChannel"
] |
a670f17a2186c9a15725f26617d77ce8e444e072
|
https://github.com/mgledi/DRUMS/blob/a670f17a2186c9a15725f26617d77ce8e444e072/src/main/java/com/unister/semweb/drums/sync/synchronizer/Synchronizer.java#L260-L266
|
150,636
|
MythTV-Clients/MythTV-Service-API
|
src/main/java/org/mythtv/services/api/ServerVersionQuery.java
|
ServerVersionQuery.getMythVersion
|
public static ApiVersion getMythVersion(String baseUri, long connectTimeout, TimeUnit timeUnit) throws IOException {
OkHttpClient client = new OkHttpClient();
client.setConnectTimeout(connectTimeout, timeUnit);
return getMythVersion(baseUri, client);
}
|
java
|
public static ApiVersion getMythVersion(String baseUri, long connectTimeout, TimeUnit timeUnit) throws IOException {
OkHttpClient client = new OkHttpClient();
client.setConnectTimeout(connectTimeout, timeUnit);
return getMythVersion(baseUri, client);
}
|
[
"public",
"static",
"ApiVersion",
"getMythVersion",
"(",
"String",
"baseUri",
",",
"long",
"connectTimeout",
",",
"TimeUnit",
"timeUnit",
")",
"throws",
"IOException",
"{",
"OkHttpClient",
"client",
"=",
"new",
"OkHttpClient",
"(",
")",
";",
"client",
".",
"setConnectTimeout",
"(",
"connectTimeout",
",",
"timeUnit",
")",
";",
"return",
"getMythVersion",
"(",
"baseUri",
",",
"client",
")",
";",
"}"
] |
Gets the api version of the given backend
@param baseUri the backend services api url
@param connectTimeout connection timeout
@param timeUnit connection timeout unit
@return the Api version
@throws IOException if an error occurs
|
[
"Gets",
"the",
"api",
"version",
"of",
"the",
"given",
"backend"
] |
7951954f767515550738f1b064d6c97099e6df15
|
https://github.com/MythTV-Clients/MythTV-Service-API/blob/7951954f767515550738f1b064d6c97099e6df15/src/main/java/org/mythtv/services/api/ServerVersionQuery.java#L43-L47
|
150,637
|
MythTV-Clients/MythTV-Service-API
|
src/main/java/org/mythtv/services/api/ServerVersionQuery.java
|
ServerVersionQuery.isServerReachable
|
public static boolean isServerReachable(String baseUrl, long connectTimeout, TimeUnit timeUnit) throws IOException {
OkHttpClient client = new OkHttpClient();
client.setConnectTimeout(connectTimeout, timeUnit);
return isServerReachable(baseUrl, client);
}
|
java
|
public static boolean isServerReachable(String baseUrl, long connectTimeout, TimeUnit timeUnit) throws IOException {
OkHttpClient client = new OkHttpClient();
client.setConnectTimeout(connectTimeout, timeUnit);
return isServerReachable(baseUrl, client);
}
|
[
"public",
"static",
"boolean",
"isServerReachable",
"(",
"String",
"baseUrl",
",",
"long",
"connectTimeout",
",",
"TimeUnit",
"timeUnit",
")",
"throws",
"IOException",
"{",
"OkHttpClient",
"client",
"=",
"new",
"OkHttpClient",
"(",
")",
";",
"client",
".",
"setConnectTimeout",
"(",
"connectTimeout",
",",
"timeUnit",
")",
";",
"return",
"isServerReachable",
"(",
"baseUrl",
",",
"client",
")",
";",
"}"
] |
Check if the server is reachable
@param baseUrl The url of the server to test
@param connectTimeout connection timeout
@param timeUnit connection timeout unit
@return true if reachable otherwise false.
@throws IOException if an error occurs
|
[
"Check",
"if",
"the",
"server",
"is",
"reachable"
] |
7951954f767515550738f1b064d6c97099e6df15
|
https://github.com/MythTV-Clients/MythTV-Service-API/blob/7951954f767515550738f1b064d6c97099e6df15/src/main/java/org/mythtv/services/api/ServerVersionQuery.java#L110-L114
|
150,638
|
jtrfp/javamod
|
src/main/java/de/quippy/javamod/multimedia/mp3/id3/ID3v2ExtendedHeader.java
|
ID3v2ExtendedHeader.readExtendedHeader
|
private void readExtendedHeader(RandomAccessInputStream raf) throws IOException, ID3v2FormatException
{
raf.seek(EXT_HEAD_LOCATION);
byte[] buf = new byte[4];
if (raf.read(buf) != buf.length)
{
throw new IOException("Error reading extended header:size");
}
size = Helpers.convertDWordToInt(buf, 0);
if (size < MIN_SIZE)
{
throw new ID3v2FormatException("The extended header size data is less than the minimum required size (" + size + '<' + MIN_SIZE + ").");
}
numFlagBytes = raf.read();
buf = new byte[numFlagBytes + 1];
if (raf.read(buf) != buf.length)
{
throw new IOException("Error reading extended header:flags");
}
parseFlags(buf);
}
|
java
|
private void readExtendedHeader(RandomAccessInputStream raf) throws IOException, ID3v2FormatException
{
raf.seek(EXT_HEAD_LOCATION);
byte[] buf = new byte[4];
if (raf.read(buf) != buf.length)
{
throw new IOException("Error reading extended header:size");
}
size = Helpers.convertDWordToInt(buf, 0);
if (size < MIN_SIZE)
{
throw new ID3v2FormatException("The extended header size data is less than the minimum required size (" + size + '<' + MIN_SIZE + ").");
}
numFlagBytes = raf.read();
buf = new byte[numFlagBytes + 1];
if (raf.read(buf) != buf.length)
{
throw new IOException("Error reading extended header:flags");
}
parseFlags(buf);
}
|
[
"private",
"void",
"readExtendedHeader",
"(",
"RandomAccessInputStream",
"raf",
")",
"throws",
"IOException",
",",
"ID3v2FormatException",
"{",
"raf",
".",
"seek",
"(",
"EXT_HEAD_LOCATION",
")",
";",
"byte",
"[",
"]",
"buf",
"=",
"new",
"byte",
"[",
"4",
"]",
";",
"if",
"(",
"raf",
".",
"read",
"(",
"buf",
")",
"!=",
"buf",
".",
"length",
")",
"{",
"throw",
"new",
"IOException",
"(",
"\"Error reading extended header:size\"",
")",
";",
"}",
"size",
"=",
"Helpers",
".",
"convertDWordToInt",
"(",
"buf",
",",
"0",
")",
";",
"if",
"(",
"size",
"<",
"MIN_SIZE",
")",
"{",
"throw",
"new",
"ID3v2FormatException",
"(",
"\"The extended header size data is less than the minimum required size (\"",
"+",
"size",
"+",
"'",
"'",
"+",
"MIN_SIZE",
"+",
"\").\"",
")",
";",
"}",
"numFlagBytes",
"=",
"raf",
".",
"read",
"(",
")",
";",
"buf",
"=",
"new",
"byte",
"[",
"numFlagBytes",
"+",
"1",
"]",
";",
"if",
"(",
"raf",
".",
"read",
"(",
"buf",
")",
"!=",
"buf",
".",
"length",
")",
"{",
"throw",
"new",
"IOException",
"(",
"\"Error reading extended header:flags\"",
")",
";",
"}",
"parseFlags",
"(",
"buf",
")",
";",
"}"
] |
Read the information in the file's extended header
@exception FileNotFoundException if an error occurs
@exception IOException if an error occurs
@exception ID3v2FormatException if an error occurs
|
[
"Read",
"the",
"information",
"in",
"the",
"file",
"s",
"extended",
"header"
] |
cda4fe943a589dc49415f4413453e2eece72076a
|
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/javamod/multimedia/mp3/id3/ID3v2ExtendedHeader.java#L92-L116
|
150,639
|
jtrfp/javamod
|
src/main/java/de/quippy/javamod/multimedia/mp3/id3/ID3v2ExtendedHeader.java
|
ID3v2ExtendedHeader.parseFlags
|
private void parseFlags(byte[] flags) throws ID3v2FormatException
{
int bytesRead = 1;
update = (flags[0]&0x80)!=0;
if (update) bytesRead++;
crced = (flags[0]&0x40)!=0;
if (crced)
{
bytesRead++;
for (int i = 0; i < crc.length; i++) crc[i] = flags[bytesRead++];
}
if ((flags[0]&0x80)!=0)
{
bytesRead++;
byte b = flags[bytesRead];
maxTagSize = (b&0xC0)>>6;
textEncode = (b&0x20)!=0;
maxTextSize = (b&0x18)>>3;
imageEncode = (b&0x04)!=0;
imageRestrict = (b&0x03);
bytesRead++;
}
if (bytesRead != numFlagBytes)
{
throw new ID3v2FormatException("The number of found flag bytes in the extended header is not equal to the number specified in the extended header.");
}
}
|
java
|
private void parseFlags(byte[] flags) throws ID3v2FormatException
{
int bytesRead = 1;
update = (flags[0]&0x80)!=0;
if (update) bytesRead++;
crced = (flags[0]&0x40)!=0;
if (crced)
{
bytesRead++;
for (int i = 0; i < crc.length; i++) crc[i] = flags[bytesRead++];
}
if ((flags[0]&0x80)!=0)
{
bytesRead++;
byte b = flags[bytesRead];
maxTagSize = (b&0xC0)>>6;
textEncode = (b&0x20)!=0;
maxTextSize = (b&0x18)>>3;
imageEncode = (b&0x04)!=0;
imageRestrict = (b&0x03);
bytesRead++;
}
if (bytesRead != numFlagBytes)
{
throw new ID3v2FormatException("The number of found flag bytes in the extended header is not equal to the number specified in the extended header.");
}
}
|
[
"private",
"void",
"parseFlags",
"(",
"byte",
"[",
"]",
"flags",
")",
"throws",
"ID3v2FormatException",
"{",
"int",
"bytesRead",
"=",
"1",
";",
"update",
"=",
"(",
"flags",
"[",
"0",
"]",
"&",
"0x80",
")",
"!=",
"0",
";",
"if",
"(",
"update",
")",
"bytesRead",
"++",
";",
"crced",
"=",
"(",
"flags",
"[",
"0",
"]",
"&",
"0x40",
")",
"!=",
"0",
";",
"if",
"(",
"crced",
")",
"{",
"bytesRead",
"++",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"crc",
".",
"length",
";",
"i",
"++",
")",
"crc",
"[",
"i",
"]",
"=",
"flags",
"[",
"bytesRead",
"++",
"]",
";",
"}",
"if",
"(",
"(",
"flags",
"[",
"0",
"]",
"&",
"0x80",
")",
"!=",
"0",
")",
"{",
"bytesRead",
"++",
";",
"byte",
"b",
"=",
"flags",
"[",
"bytesRead",
"]",
";",
"maxTagSize",
"=",
"(",
"b",
"&",
"0xC0",
")",
">>",
"6",
";",
"textEncode",
"=",
"(",
"b",
"&",
"0x20",
")",
"!=",
"0",
";",
"maxTextSize",
"=",
"(",
"b",
"&",
"0x18",
")",
">>",
"3",
";",
"imageEncode",
"=",
"(",
"b",
"&",
"0x04",
")",
"!=",
"0",
";",
"imageRestrict",
"=",
"(",
"b",
"&",
"0x03",
")",
";",
"bytesRead",
"++",
";",
"}",
"if",
"(",
"bytesRead",
"!=",
"numFlagBytes",
")",
"{",
"throw",
"new",
"ID3v2FormatException",
"(",
"\"The number of found flag bytes in the extended header is not equal to the number specified in the extended header.\"",
")",
";",
"}",
"}"
] |
Parse the extended header flag bytes
@param flags the array of extended flags
@exception ID3v2FormatException if an error occurs
|
[
"Parse",
"the",
"extended",
"header",
"flag",
"bytes"
] |
cda4fe943a589dc49415f4413453e2eece72076a
|
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/javamod/multimedia/mp3/id3/ID3v2ExtendedHeader.java#L124-L153
|
150,640
|
jtrfp/javamod
|
src/main/java/de/quippy/javamod/multimedia/mp3/id3/ID3v2ExtendedHeader.java
|
ID3v2ExtendedHeader.getFlagBytes
|
private byte[] getFlagBytes()
{
byte[] b = new byte[numFlagBytes];
int bytesCopied = 1;
b[0] = 0;
if (update)
{
b[0] |= 0x80;
b[bytesCopied++] = 0;
}
if (crced)
{
b[0] |= 0x40;
b[bytesCopied++] = (byte) crc.length;
System.arraycopy(crc, 0, b, bytesCopied, crc.length);
bytesCopied += crc.length;
}
if ((maxTagSize != -1) || textEncode || (maxTextSize != -1) || imageEncode || (imageRestrict != -1))
{
b[0] |= 0x20;
b[bytesCopied++] = 0x01;
byte restrict = 0;
if (maxTagSize != -1) restrict |= (byte)((maxTagSize&0x3)<<6);
if (textEncode) restrict |= 0x20;
if (maxTextSize != -1) restrict |= (byte)((maxTextSize&0x3)<<3);
if (imageEncode) restrict |= 0x04;
if (imageRestrict != -1) restrict |= (byte)(imageRestrict&0x3);
b[bytesCopied++] = restrict;
}
return b;
}
|
java
|
private byte[] getFlagBytes()
{
byte[] b = new byte[numFlagBytes];
int bytesCopied = 1;
b[0] = 0;
if (update)
{
b[0] |= 0x80;
b[bytesCopied++] = 0;
}
if (crced)
{
b[0] |= 0x40;
b[bytesCopied++] = (byte) crc.length;
System.arraycopy(crc, 0, b, bytesCopied, crc.length);
bytesCopied += crc.length;
}
if ((maxTagSize != -1) || textEncode || (maxTextSize != -1) || imageEncode || (imageRestrict != -1))
{
b[0] |= 0x20;
b[bytesCopied++] = 0x01;
byte restrict = 0;
if (maxTagSize != -1) restrict |= (byte)((maxTagSize&0x3)<<6);
if (textEncode) restrict |= 0x20;
if (maxTextSize != -1) restrict |= (byte)((maxTextSize&0x3)<<3);
if (imageEncode) restrict |= 0x04;
if (imageRestrict != -1) restrict |= (byte)(imageRestrict&0x3);
b[bytesCopied++] = restrict;
}
return b;
}
|
[
"private",
"byte",
"[",
"]",
"getFlagBytes",
"(",
")",
"{",
"byte",
"[",
"]",
"b",
"=",
"new",
"byte",
"[",
"numFlagBytes",
"]",
";",
"int",
"bytesCopied",
"=",
"1",
";",
"b",
"[",
"0",
"]",
"=",
"0",
";",
"if",
"(",
"update",
")",
"{",
"b",
"[",
"0",
"]",
"|=",
"0x80",
";",
"b",
"[",
"bytesCopied",
"++",
"]",
"=",
"0",
";",
"}",
"if",
"(",
"crced",
")",
"{",
"b",
"[",
"0",
"]",
"|=",
"0x40",
";",
"b",
"[",
"bytesCopied",
"++",
"]",
"=",
"(",
"byte",
")",
"crc",
".",
"length",
";",
"System",
".",
"arraycopy",
"(",
"crc",
",",
"0",
",",
"b",
",",
"bytesCopied",
",",
"crc",
".",
"length",
")",
";",
"bytesCopied",
"+=",
"crc",
".",
"length",
";",
"}",
"if",
"(",
"(",
"maxTagSize",
"!=",
"-",
"1",
")",
"||",
"textEncode",
"||",
"(",
"maxTextSize",
"!=",
"-",
"1",
")",
"||",
"imageEncode",
"||",
"(",
"imageRestrict",
"!=",
"-",
"1",
")",
")",
"{",
"b",
"[",
"0",
"]",
"|=",
"0x20",
";",
"b",
"[",
"bytesCopied",
"++",
"]",
"=",
"0x01",
";",
"byte",
"restrict",
"=",
"0",
";",
"if",
"(",
"maxTagSize",
"!=",
"-",
"1",
")",
"restrict",
"|=",
"(",
"byte",
")",
"(",
"(",
"maxTagSize",
"&",
"0x3",
")",
"<<",
"6",
")",
";",
"if",
"(",
"textEncode",
")",
"restrict",
"|=",
"0x20",
";",
"if",
"(",
"maxTextSize",
"!=",
"-",
"1",
")",
"restrict",
"|=",
"(",
"byte",
")",
"(",
"(",
"maxTextSize",
"&",
"0x3",
")",
"<<",
"3",
")",
";",
"if",
"(",
"imageEncode",
")",
"restrict",
"|=",
"0x04",
";",
"if",
"(",
"imageRestrict",
"!=",
"-",
"1",
")",
"restrict",
"|=",
"(",
"byte",
")",
"(",
"imageRestrict",
"&",
"0x3",
")",
";",
"b",
"[",
"bytesCopied",
"++",
"]",
"=",
"restrict",
";",
"}",
"return",
"b",
";",
"}"
] |
A helper function for the getBytes method that returns a byte array
representing the extended flags field of the extended header.
@return the extended flags field of the extended header
|
[
"A",
"helper",
"function",
"for",
"the",
"getBytes",
"method",
"that",
"returns",
"a",
"byte",
"array",
"representing",
"the",
"extended",
"flags",
"field",
"of",
"the",
"extended",
"header",
"."
] |
cda4fe943a589dc49415f4413453e2eece72076a
|
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/javamod/multimedia/mp3/id3/ID3v2ExtendedHeader.java#L160-L192
|
150,641
|
jtrfp/javamod
|
src/main/java/de/quippy/javamod/multimedia/mp3/id3/ID3v2ExtendedHeader.java
|
ID3v2ExtendedHeader.getBytes
|
public byte[] getBytes()
{
byte[] b = new byte[size];
int bytesCopied = 0;
System.arraycopy(Helpers.convertIntToDWord(size), 0, b, bytesCopied, 4);
bytesCopied += 4;
b[bytesCopied++] = (byte) numFlagBytes;
System.arraycopy(getFlagBytes(), 0, b, bytesCopied, numFlagBytes);
bytesCopied += numFlagBytes;
return b;
}
|
java
|
public byte[] getBytes()
{
byte[] b = new byte[size];
int bytesCopied = 0;
System.arraycopy(Helpers.convertIntToDWord(size), 0, b, bytesCopied, 4);
bytesCopied += 4;
b[bytesCopied++] = (byte) numFlagBytes;
System.arraycopy(getFlagBytes(), 0, b, bytesCopied, numFlagBytes);
bytesCopied += numFlagBytes;
return b;
}
|
[
"public",
"byte",
"[",
"]",
"getBytes",
"(",
")",
"{",
"byte",
"[",
"]",
"b",
"=",
"new",
"byte",
"[",
"size",
"]",
";",
"int",
"bytesCopied",
"=",
"0",
";",
"System",
".",
"arraycopy",
"(",
"Helpers",
".",
"convertIntToDWord",
"(",
"size",
")",
",",
"0",
",",
"b",
",",
"bytesCopied",
",",
"4",
")",
";",
"bytesCopied",
"+=",
"4",
";",
"b",
"[",
"bytesCopied",
"++",
"]",
"=",
"(",
"byte",
")",
"numFlagBytes",
";",
"System",
".",
"arraycopy",
"(",
"getFlagBytes",
"(",
")",
",",
"0",
",",
"b",
",",
"bytesCopied",
",",
"numFlagBytes",
")",
";",
"bytesCopied",
"+=",
"numFlagBytes",
";",
"return",
"b",
";",
"}"
] |
Return an array of bytes representing this extended header in the
standard format to be written to a file.
@return a binary represenation of this extended header
|
[
"Return",
"an",
"array",
"of",
"bytes",
"representing",
"this",
"extended",
"header",
"in",
"the",
"standard",
"format",
"to",
"be",
"written",
"to",
"a",
"file",
"."
] |
cda4fe943a589dc49415f4413453e2eece72076a
|
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/javamod/multimedia/mp3/id3/ID3v2ExtendedHeader.java#L200-L212
|
150,642
|
jtrfp/javamod
|
src/main/java/de/quippy/javamod/multimedia/mp3/id3/ID3v2ExtendedHeader.java
|
ID3v2ExtendedHeader.getMaxFrames
|
public int getMaxFrames()
{
int retval = -1;
if ((maxTagSize >= 0) && (maxTagSize < MAX_TAG_FRAMES_TABLE.length))
{
retval = MAX_TAG_FRAMES_TABLE[maxTagSize];
}
return retval;
}
|
java
|
public int getMaxFrames()
{
int retval = -1;
if ((maxTagSize >= 0) && (maxTagSize < MAX_TAG_FRAMES_TABLE.length))
{
retval = MAX_TAG_FRAMES_TABLE[maxTagSize];
}
return retval;
}
|
[
"public",
"int",
"getMaxFrames",
"(",
")",
"{",
"int",
"retval",
"=",
"-",
"1",
";",
"if",
"(",
"(",
"maxTagSize",
">=",
"0",
")",
"&&",
"(",
"maxTagSize",
"<",
"MAX_TAG_FRAMES_TABLE",
".",
"length",
")",
")",
"{",
"retval",
"=",
"MAX_TAG_FRAMES_TABLE",
"[",
"maxTagSize",
"]",
";",
"}",
"return",
"retval",
";",
"}"
] |
Returns the maximum number of frames if set. If unset, returns -1
@return the maximum number of frames or -1 if unset
|
[
"Returns",
"the",
"maximum",
"number",
"of",
"frames",
"if",
"set",
".",
"If",
"unset",
"returns",
"-",
"1"
] |
cda4fe943a589dc49415f4413453e2eece72076a
|
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/javamod/multimedia/mp3/id3/ID3v2ExtendedHeader.java#L239-L249
|
150,643
|
jtrfp/javamod
|
src/main/java/de/quippy/javamod/multimedia/mp3/id3/ID3v2ExtendedHeader.java
|
ID3v2ExtendedHeader.getMaxTagSize
|
public int getMaxTagSize()
{
int retval = -1;
if ((maxTagSize >= 0) && (maxTagSize < MAX_TAG_SIZE_TABLE.length))
{
retval = MAX_TAG_SIZE_TABLE[maxTagSize];
}
return retval;
}
|
java
|
public int getMaxTagSize()
{
int retval = -1;
if ((maxTagSize >= 0) && (maxTagSize < MAX_TAG_SIZE_TABLE.length))
{
retval = MAX_TAG_SIZE_TABLE[maxTagSize];
}
return retval;
}
|
[
"public",
"int",
"getMaxTagSize",
"(",
")",
"{",
"int",
"retval",
"=",
"-",
"1",
";",
"if",
"(",
"(",
"maxTagSize",
">=",
"0",
")",
"&&",
"(",
"maxTagSize",
"<",
"MAX_TAG_SIZE_TABLE",
".",
"length",
")",
")",
"{",
"retval",
"=",
"MAX_TAG_SIZE_TABLE",
"[",
"maxTagSize",
"]",
";",
"}",
"return",
"retval",
";",
"}"
] |
Returns the maximum tag size or -1 if unset
@return the maximum tag size or -1 if unset
|
[
"Returns",
"the",
"maximum",
"tag",
"size",
"or",
"-",
"1",
"if",
"unset"
] |
cda4fe943a589dc49415f4413453e2eece72076a
|
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/javamod/multimedia/mp3/id3/ID3v2ExtendedHeader.java#L256-L266
|
150,644
|
jtrfp/javamod
|
src/main/java/de/quippy/javamod/multimedia/mp3/id3/ID3v2ExtendedHeader.java
|
ID3v2ExtendedHeader.getMaxTextSize
|
public int getMaxTextSize()
{
int retval = -1;
if ((maxTextSize >= 0) && (maxTextSize < MAX_TEXT_SIZE_TABLE.length))
{
retval = MAX_TEXT_SIZE_TABLE[maxTextSize];
}
return retval;
}
|
java
|
public int getMaxTextSize()
{
int retval = -1;
if ((maxTextSize >= 0) && (maxTextSize < MAX_TEXT_SIZE_TABLE.length))
{
retval = MAX_TEXT_SIZE_TABLE[maxTextSize];
}
return retval;
}
|
[
"public",
"int",
"getMaxTextSize",
"(",
")",
"{",
"int",
"retval",
"=",
"-",
"1",
";",
"if",
"(",
"(",
"maxTextSize",
">=",
"0",
")",
"&&",
"(",
"maxTextSize",
"<",
"MAX_TEXT_SIZE_TABLE",
".",
"length",
")",
")",
"{",
"retval",
"=",
"MAX_TEXT_SIZE_TABLE",
"[",
"maxTextSize",
"]",
";",
"}",
"return",
"retval",
";",
"}"
] |
Returns the maximum length of a string if set or -1
@return the maximum length of a string if set or -1
|
[
"Returns",
"the",
"maximum",
"length",
"of",
"a",
"string",
"if",
"set",
"or",
"-",
"1"
] |
cda4fe943a589dc49415f4413453e2eece72076a
|
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/javamod/multimedia/mp3/id3/ID3v2ExtendedHeader.java#L283-L293
|
150,645
|
vdmeer/skb-java-base
|
src/main/java/de/vandermeer/skb/base/info/SimpleDirectoryScanner.java
|
SimpleDirectoryScanner.clear
|
public void clear(){
this.errors.clearErrorMessages();;
this.warnings.clear();
this.infos.clear();
this.scDir = 0;
this.scDirUnreadable = 0;
this.scFiles = 0;
this.scFilesUnreadable = 0;
}
|
java
|
public void clear(){
this.errors.clearErrorMessages();;
this.warnings.clear();
this.infos.clear();
this.scDir = 0;
this.scDirUnreadable = 0;
this.scFiles = 0;
this.scFilesUnreadable = 0;
}
|
[
"public",
"void",
"clear",
"(",
")",
"{",
"this",
".",
"errors",
".",
"clearErrorMessages",
"(",
")",
";",
";",
"this",
".",
"warnings",
".",
"clear",
"(",
")",
";",
"this",
".",
"infos",
".",
"clear",
"(",
")",
";",
"this",
".",
"scDir",
"=",
"0",
";",
"this",
".",
"scDirUnreadable",
"=",
"0",
";",
"this",
".",
"scFiles",
"=",
"0",
";",
"this",
".",
"scFilesUnreadable",
"=",
"0",
";",
"}"
] |
Clears errors and warnings, automatically called for new scans.
|
[
"Clears",
"errors",
"and",
"warnings",
"automatically",
"called",
"for",
"new",
"scans",
"."
] |
6d845bcc482aa9344d016e80c0c3455aeae13a13
|
https://github.com/vdmeer/skb-java-base/blob/6d845bcc482aa9344d016e80c0c3455aeae13a13/src/main/java/de/vandermeer/skb/base/info/SimpleDirectoryScanner.java#L69-L79
|
150,646
|
vdmeer/skb-java-base
|
src/main/java/de/vandermeer/skb/base/info/SimpleDirectoryScanner.java
|
SimpleDirectoryScanner.doInfo
|
void doInfo(){
this.infos.add("scanned directories: " + this.scDir);
this.infos.add("unreadable directories: " + this.scDirUnreadable);
this.infos.add("found files: " + this.scFiles);
this.infos.add("unreadable files: " + this.scFilesUnreadable);
}
|
java
|
void doInfo(){
this.infos.add("scanned directories: " + this.scDir);
this.infos.add("unreadable directories: " + this.scDirUnreadable);
this.infos.add("found files: " + this.scFiles);
this.infos.add("unreadable files: " + this.scFilesUnreadable);
}
|
[
"void",
"doInfo",
"(",
")",
"{",
"this",
".",
"infos",
".",
"add",
"(",
"\"scanned directories: \"",
"+",
"this",
".",
"scDir",
")",
";",
"this",
".",
"infos",
".",
"add",
"(",
"\"unreadable directories: \"",
"+",
"this",
".",
"scDirUnreadable",
")",
";",
"this",
".",
"infos",
".",
"add",
"(",
"\"found files: \"",
"+",
"this",
".",
"scFiles",
")",
";",
"this",
".",
"infos",
".",
"add",
"(",
"\"unreadable files: \"",
"+",
"this",
".",
"scFilesUnreadable",
")",
";",
"}"
] |
Generate a few strings with collected information about the scan.
|
[
"Generate",
"a",
"few",
"strings",
"with",
"collected",
"information",
"about",
"the",
"scan",
"."
] |
6d845bcc482aa9344d016e80c0c3455aeae13a13
|
https://github.com/vdmeer/skb-java-base/blob/6d845bcc482aa9344d016e80c0c3455aeae13a13/src/main/java/de/vandermeer/skb/base/info/SimpleDirectoryScanner.java#L98-L104
|
150,647
|
vdmeer/skb-java-base
|
src/main/java/de/vandermeer/skb/base/info/SimpleDirectoryScanner.java
|
SimpleDirectoryScanner.doScan
|
protected List<FileSource> doScan(File fDir){
List<FileSource> ret = new ArrayList<>();
if(fDir!=null && fDir.exists() && !fDir.isHidden()){
for(final File entry : fDir.listFiles()) {
if(entry.isHidden()){
continue;
}
if(!entry.isDirectory()) {
this.scFiles++;
if(entry.canRead()){
ret.add(new FileSource(entry, this.source.getSetRootPath()));
}
else{
this.scFilesUnreadable++;
this.warnings.add("found file <" + entry.getAbsolutePath() + "> but cannot read, ignore");
}
}
else if(entry.isDirectory()){
this.scDir++;
if(entry.canRead()){
ret.addAll(this.doScan(entry));
}
else{
this.scDirUnreadable++;
this.warnings.add("found directory <" + entry.getAbsolutePath() + "> but cannot read, ignore");
}
}
}
}
return ret;
}
|
java
|
protected List<FileSource> doScan(File fDir){
List<FileSource> ret = new ArrayList<>();
if(fDir!=null && fDir.exists() && !fDir.isHidden()){
for(final File entry : fDir.listFiles()) {
if(entry.isHidden()){
continue;
}
if(!entry.isDirectory()) {
this.scFiles++;
if(entry.canRead()){
ret.add(new FileSource(entry, this.source.getSetRootPath()));
}
else{
this.scFilesUnreadable++;
this.warnings.add("found file <" + entry.getAbsolutePath() + "> but cannot read, ignore");
}
}
else if(entry.isDirectory()){
this.scDir++;
if(entry.canRead()){
ret.addAll(this.doScan(entry));
}
else{
this.scDirUnreadable++;
this.warnings.add("found directory <" + entry.getAbsolutePath() + "> but cannot read, ignore");
}
}
}
}
return ret;
}
|
[
"protected",
"List",
"<",
"FileSource",
">",
"doScan",
"(",
"File",
"fDir",
")",
"{",
"List",
"<",
"FileSource",
">",
"ret",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"if",
"(",
"fDir",
"!=",
"null",
"&&",
"fDir",
".",
"exists",
"(",
")",
"&&",
"!",
"fDir",
".",
"isHidden",
"(",
")",
")",
"{",
"for",
"(",
"final",
"File",
"entry",
":",
"fDir",
".",
"listFiles",
"(",
")",
")",
"{",
"if",
"(",
"entry",
".",
"isHidden",
"(",
")",
")",
"{",
"continue",
";",
"}",
"if",
"(",
"!",
"entry",
".",
"isDirectory",
"(",
")",
")",
"{",
"this",
".",
"scFiles",
"++",
";",
"if",
"(",
"entry",
".",
"canRead",
"(",
")",
")",
"{",
"ret",
".",
"add",
"(",
"new",
"FileSource",
"(",
"entry",
",",
"this",
".",
"source",
".",
"getSetRootPath",
"(",
")",
")",
")",
";",
"}",
"else",
"{",
"this",
".",
"scFilesUnreadable",
"++",
";",
"this",
".",
"warnings",
".",
"add",
"(",
"\"found file <\"",
"+",
"entry",
".",
"getAbsolutePath",
"(",
")",
"+",
"\"> but cannot read, ignore\"",
")",
";",
"}",
"}",
"else",
"if",
"(",
"entry",
".",
"isDirectory",
"(",
")",
")",
"{",
"this",
".",
"scDir",
"++",
";",
"if",
"(",
"entry",
".",
"canRead",
"(",
")",
")",
"{",
"ret",
".",
"addAll",
"(",
"this",
".",
"doScan",
"(",
"entry",
")",
")",
";",
"}",
"else",
"{",
"this",
".",
"scDirUnreadable",
"++",
";",
"this",
".",
"warnings",
".",
"add",
"(",
"\"found directory <\"",
"+",
"entry",
".",
"getAbsolutePath",
"(",
")",
"+",
"\"> but cannot read, ignore\"",
")",
";",
"}",
"}",
"}",
"}",
"return",
"ret",
";",
"}"
] |
Does the actual scan of a directory.
@param fDir starting directory
@return set of found and readable files, empty set of none found
|
[
"Does",
"the",
"actual",
"scan",
"of",
"a",
"directory",
"."
] |
6d845bcc482aa9344d016e80c0c3455aeae13a13
|
https://github.com/vdmeer/skb-java-base/blob/6d845bcc482aa9344d016e80c0c3455aeae13a13/src/main/java/de/vandermeer/skb/base/info/SimpleDirectoryScanner.java#L111-L141
|
150,648
|
jtrfp/javamod
|
src/main/java/de/quippy/jflac/io/BitOutputStream.java
|
BitOutputStream.concatenateAligned
|
public boolean concatenateAligned(BitOutputStream src) {
int bitsToAdd = src.totalBits - src.totalConsumedBits;
if (bitsToAdd == 0) return true;
if (outBits != src.consumedBits) return false;
if (!ensureSize(bitsToAdd)) return false;
if (outBits == 0) {
System.arraycopy(src.buffer, src.consumedBlurbs, buffer, outBlurbs,
(src.outBlurbs - src.consumedBlurbs + ((src.outBits != 0) ? 1 : 0)));
} else if (outBits + bitsToAdd > BITS_PER_BLURB) {
buffer[outBlurbs] <<= (BITS_PER_BLURB - outBits);
buffer[outBlurbs] |= (src.buffer[src.consumedBlurbs] & ((1 << (BITS_PER_BLURB - outBits)) - 1));
System.arraycopy(src.buffer, src.consumedBlurbs + 1, buffer, outBlurbs + 11,
(src.outBlurbs - src.consumedBlurbs - 1 + ((src.outBits != 0) ? 1 : 0)));
} else {
buffer[outBlurbs] <<= bitsToAdd;
buffer[outBlurbs] |= (src.buffer[src.consumedBlurbs] & ((1 << bitsToAdd) - 1));
}
outBits = src.outBits;
totalBits += bitsToAdd;
outBlurbs = totalBits / BITS_PER_BLURB;
return true;
}
|
java
|
public boolean concatenateAligned(BitOutputStream src) {
int bitsToAdd = src.totalBits - src.totalConsumedBits;
if (bitsToAdd == 0) return true;
if (outBits != src.consumedBits) return false;
if (!ensureSize(bitsToAdd)) return false;
if (outBits == 0) {
System.arraycopy(src.buffer, src.consumedBlurbs, buffer, outBlurbs,
(src.outBlurbs - src.consumedBlurbs + ((src.outBits != 0) ? 1 : 0)));
} else if (outBits + bitsToAdd > BITS_PER_BLURB) {
buffer[outBlurbs] <<= (BITS_PER_BLURB - outBits);
buffer[outBlurbs] |= (src.buffer[src.consumedBlurbs] & ((1 << (BITS_PER_BLURB - outBits)) - 1));
System.arraycopy(src.buffer, src.consumedBlurbs + 1, buffer, outBlurbs + 11,
(src.outBlurbs - src.consumedBlurbs - 1 + ((src.outBits != 0) ? 1 : 0)));
} else {
buffer[outBlurbs] <<= bitsToAdd;
buffer[outBlurbs] |= (src.buffer[src.consumedBlurbs] & ((1 << bitsToAdd) - 1));
}
outBits = src.outBits;
totalBits += bitsToAdd;
outBlurbs = totalBits / BITS_PER_BLURB;
return true;
}
|
[
"public",
"boolean",
"concatenateAligned",
"(",
"BitOutputStream",
"src",
")",
"{",
"int",
"bitsToAdd",
"=",
"src",
".",
"totalBits",
"-",
"src",
".",
"totalConsumedBits",
";",
"if",
"(",
"bitsToAdd",
"==",
"0",
")",
"return",
"true",
";",
"if",
"(",
"outBits",
"!=",
"src",
".",
"consumedBits",
")",
"return",
"false",
";",
"if",
"(",
"!",
"ensureSize",
"(",
"bitsToAdd",
")",
")",
"return",
"false",
";",
"if",
"(",
"outBits",
"==",
"0",
")",
"{",
"System",
".",
"arraycopy",
"(",
"src",
".",
"buffer",
",",
"src",
".",
"consumedBlurbs",
",",
"buffer",
",",
"outBlurbs",
",",
"(",
"src",
".",
"outBlurbs",
"-",
"src",
".",
"consumedBlurbs",
"+",
"(",
"(",
"src",
".",
"outBits",
"!=",
"0",
")",
"?",
"1",
":",
"0",
")",
")",
")",
";",
"}",
"else",
"if",
"(",
"outBits",
"+",
"bitsToAdd",
">",
"BITS_PER_BLURB",
")",
"{",
"buffer",
"[",
"outBlurbs",
"]",
"<<=",
"(",
"BITS_PER_BLURB",
"-",
"outBits",
")",
";",
"buffer",
"[",
"outBlurbs",
"]",
"|=",
"(",
"src",
".",
"buffer",
"[",
"src",
".",
"consumedBlurbs",
"]",
"&",
"(",
"(",
"1",
"<<",
"(",
"BITS_PER_BLURB",
"-",
"outBits",
")",
")",
"-",
"1",
")",
")",
";",
"System",
".",
"arraycopy",
"(",
"src",
".",
"buffer",
",",
"src",
".",
"consumedBlurbs",
"+",
"1",
",",
"buffer",
",",
"outBlurbs",
"+",
"11",
",",
"(",
"src",
".",
"outBlurbs",
"-",
"src",
".",
"consumedBlurbs",
"-",
"1",
"+",
"(",
"(",
"src",
".",
"outBits",
"!=",
"0",
")",
"?",
"1",
":",
"0",
")",
")",
")",
";",
"}",
"else",
"{",
"buffer",
"[",
"outBlurbs",
"]",
"<<=",
"bitsToAdd",
";",
"buffer",
"[",
"outBlurbs",
"]",
"|=",
"(",
"src",
".",
"buffer",
"[",
"src",
".",
"consumedBlurbs",
"]",
"&",
"(",
"(",
"1",
"<<",
"bitsToAdd",
")",
"-",
"1",
")",
")",
";",
"}",
"outBits",
"=",
"src",
".",
"outBits",
";",
"totalBits",
"+=",
"bitsToAdd",
";",
"outBlurbs",
"=",
"totalBits",
"/",
"BITS_PER_BLURB",
";",
"return",
"true",
";",
"}"
] |
Concatinate one InputBitStream to the end of this one.
@param src The inputBitStream to copy
@return True if copy was successful
|
[
"Concatinate",
"one",
"InputBitStream",
"to",
"the",
"end",
"of",
"this",
"one",
"."
] |
cda4fe943a589dc49415f4413453e2eece72076a
|
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/jflac/io/BitOutputStream.java#L162-L183
|
150,649
|
jtrfp/javamod
|
src/main/java/de/quippy/jflac/io/BitOutputStream.java
|
BitOutputStream.writeZeroes
|
public void writeZeroes(int bits) throws IOException {
if (bits == 0) return;
if (!ensureSize(bits)) throw new IOException("Memory Allocation Error");
totalBits += bits;
while (bits > 0) {
int n = Math.min(BITS_PER_BLURB - outBits, bits);
buffer[outBlurbs] <<= n;
bits -= n;
outBits += n;
if (outBits == BITS_PER_BLURB) {
outBlurbs++;
outBits = 0;
}
}
}
|
java
|
public void writeZeroes(int bits) throws IOException {
if (bits == 0) return;
if (!ensureSize(bits)) throw new IOException("Memory Allocation Error");
totalBits += bits;
while (bits > 0) {
int n = Math.min(BITS_PER_BLURB - outBits, bits);
buffer[outBlurbs] <<= n;
bits -= n;
outBits += n;
if (outBits == BITS_PER_BLURB) {
outBlurbs++;
outBits = 0;
}
}
}
|
[
"public",
"void",
"writeZeroes",
"(",
"int",
"bits",
")",
"throws",
"IOException",
"{",
"if",
"(",
"bits",
"==",
"0",
")",
"return",
";",
"if",
"(",
"!",
"ensureSize",
"(",
"bits",
")",
")",
"throw",
"new",
"IOException",
"(",
"\"Memory Allocation Error\"",
")",
";",
"totalBits",
"+=",
"bits",
";",
"while",
"(",
"bits",
">",
"0",
")",
"{",
"int",
"n",
"=",
"Math",
".",
"min",
"(",
"BITS_PER_BLURB",
"-",
"outBits",
",",
"bits",
")",
";",
"buffer",
"[",
"outBlurbs",
"]",
"<<=",
"n",
";",
"bits",
"-=",
"n",
";",
"outBits",
"+=",
"n",
";",
"if",
"(",
"outBits",
"==",
"BITS_PER_BLURB",
")",
"{",
"outBlurbs",
"++",
";",
"outBits",
"=",
"0",
";",
"}",
"}",
"}"
] |
Write zero bits.
@param bits The number of zero bits to write
@throws IOException On write error
|
[
"Write",
"zero",
"bits",
"."
] |
cda4fe943a589dc49415f4413453e2eece72076a
|
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/jflac/io/BitOutputStream.java#L254-L268
|
150,650
|
jpaoletti/java-presentation-manager
|
modules/jpm-core/src/main/java/jpaoletti/jpm/validator/NotNull.java
|
NotNull.validate
|
@Override
public ValidationResult validate(PMContext ctx) {
final ValidationResult res = new ValidationResult();
final Object fieldvalue = ctx.getFieldValue();
res.setSuccessful(fieldvalue != null);
if (!res.isSuccessful()) {
res.getMessages().add(MessageFactory.error(
ctx.getEntity(), ctx.getField(),
get("msg", "pm.validator.not.null"),
ctx.getField().getId()));
}
return res;
}
|
java
|
@Override
public ValidationResult validate(PMContext ctx) {
final ValidationResult res = new ValidationResult();
final Object fieldvalue = ctx.getFieldValue();
res.setSuccessful(fieldvalue != null);
if (!res.isSuccessful()) {
res.getMessages().add(MessageFactory.error(
ctx.getEntity(), ctx.getField(),
get("msg", "pm.validator.not.null"),
ctx.getField().getId()));
}
return res;
}
|
[
"@",
"Override",
"public",
"ValidationResult",
"validate",
"(",
"PMContext",
"ctx",
")",
"{",
"final",
"ValidationResult",
"res",
"=",
"new",
"ValidationResult",
"(",
")",
";",
"final",
"Object",
"fieldvalue",
"=",
"ctx",
".",
"getFieldValue",
"(",
")",
";",
"res",
".",
"setSuccessful",
"(",
"fieldvalue",
"!=",
"null",
")",
";",
"if",
"(",
"!",
"res",
".",
"isSuccessful",
"(",
")",
")",
"{",
"res",
".",
"getMessages",
"(",
")",
".",
"add",
"(",
"MessageFactory",
".",
"error",
"(",
"ctx",
".",
"getEntity",
"(",
")",
",",
"ctx",
".",
"getField",
"(",
")",
",",
"get",
"(",
"\"msg\"",
",",
"\"pm.validator.not.null\"",
")",
",",
"ctx",
".",
"getField",
"(",
")",
".",
"getId",
"(",
")",
")",
")",
";",
"}",
"return",
"res",
";",
"}"
] |
The validation method
|
[
"The",
"validation",
"method"
] |
d5aab55638383695db244744b4bfe27c5200e04f
|
https://github.com/jpaoletti/java-presentation-manager/blob/d5aab55638383695db244744b4bfe27c5200e04f/modules/jpm-core/src/main/java/jpaoletti/jpm/validator/NotNull.java#L23-L35
|
150,651
|
satoshi-kimura/samurai-dao
|
src/main/java/ognl/DefaultMemberAccess.java
|
DefaultMemberAccess.isAccessible
|
public boolean isAccessible(Map context, Object target, Member member, String propertyName)
{
int modifiers = member.getModifiers();
boolean result = Modifier.isPublic(modifiers);
if (!result) {
if (Modifier.isPrivate(modifiers)) {
result = getAllowPrivateAccess();
} else {
if (Modifier.isProtected(modifiers)) {
result = getAllowProtectedAccess();
} else {
result = getAllowPackageProtectedAccess();
}
}
}
return result;
}
|
java
|
public boolean isAccessible(Map context, Object target, Member member, String propertyName)
{
int modifiers = member.getModifiers();
boolean result = Modifier.isPublic(modifiers);
if (!result) {
if (Modifier.isPrivate(modifiers)) {
result = getAllowPrivateAccess();
} else {
if (Modifier.isProtected(modifiers)) {
result = getAllowProtectedAccess();
} else {
result = getAllowPackageProtectedAccess();
}
}
}
return result;
}
|
[
"public",
"boolean",
"isAccessible",
"(",
"Map",
"context",
",",
"Object",
"target",
",",
"Member",
"member",
",",
"String",
"propertyName",
")",
"{",
"int",
"modifiers",
"=",
"member",
".",
"getModifiers",
"(",
")",
";",
"boolean",
"result",
"=",
"Modifier",
".",
"isPublic",
"(",
"modifiers",
")",
";",
"if",
"(",
"!",
"result",
")",
"{",
"if",
"(",
"Modifier",
".",
"isPrivate",
"(",
"modifiers",
")",
")",
"{",
"result",
"=",
"getAllowPrivateAccess",
"(",
")",
";",
"}",
"else",
"{",
"if",
"(",
"Modifier",
".",
"isProtected",
"(",
"modifiers",
")",
")",
"{",
"result",
"=",
"getAllowProtectedAccess",
"(",
")",
";",
"}",
"else",
"{",
"result",
"=",
"getAllowPackageProtectedAccess",
"(",
")",
";",
"}",
"}",
"}",
"return",
"result",
";",
"}"
] |
Returns true if the given member is accessible or can be made accessible
by this object.
|
[
"Returns",
"true",
"if",
"the",
"given",
"member",
"is",
"accessible",
"or",
"can",
"be",
"made",
"accessible",
"by",
"this",
"object",
"."
] |
321729d8928f8e83eede6cb08e4bd7f7a24e9b94
|
https://github.com/satoshi-kimura/samurai-dao/blob/321729d8928f8e83eede6cb08e4bd7f7a24e9b94/src/main/java/ognl/DefaultMemberAccess.java#L133-L150
|
150,652
|
jtrfp/javamod
|
src/main/java/de/quippy/javamod/mixer/dsp/iir/filter/IIRFilterBase.java
|
IIRFilterBase.initialize
|
public void initialize(final int sampleRate, final int channels, final int frequency, final float parameter)
{
this.frequency = frequency;
this.sampleRate = sampleRate;
inArray = new float[channels][HISTORYSIZE];
outArray = new float[channels][HISTORYSIZE];
clearHistory();
}
|
java
|
public void initialize(final int sampleRate, final int channels, final int frequency, final float parameter)
{
this.frequency = frequency;
this.sampleRate = sampleRate;
inArray = new float[channels][HISTORYSIZE];
outArray = new float[channels][HISTORYSIZE];
clearHistory();
}
|
[
"public",
"void",
"initialize",
"(",
"final",
"int",
"sampleRate",
",",
"final",
"int",
"channels",
",",
"final",
"int",
"frequency",
",",
"final",
"float",
"parameter",
")",
"{",
"this",
".",
"frequency",
"=",
"frequency",
";",
"this",
".",
"sampleRate",
"=",
"sampleRate",
";",
"inArray",
"=",
"new",
"float",
"[",
"channels",
"]",
"[",
"HISTORYSIZE",
"]",
";",
"outArray",
"=",
"new",
"float",
"[",
"channels",
"]",
"[",
"HISTORYSIZE",
"]",
";",
"clearHistory",
"(",
")",
";",
"}"
] |
Call this to initialize. Will set the memory to 0
@since 09.01.2012
|
[
"Call",
"this",
"to",
"initialize",
".",
"Will",
"set",
"the",
"memory",
"to",
"0"
] |
cda4fe943a589dc49415f4413453e2eece72076a
|
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/javamod/mixer/dsp/iir/filter/IIRFilterBase.java#L83-L90
|
150,653
|
jtrfp/javamod
|
src/main/java/de/quippy/javamod/mixer/dsp/iir/filter/IIRFilterBase.java
|
IIRFilterBase.clearHistory
|
public void clearHistory()
{
int channels = inArray.length;
for (int c=0; c<channels; c++)
{
for (int i=0; i<HISTORYSIZE; i++)
{
inArray[c][i] = outArray[c][i] = 0f;
}
}
}
|
java
|
public void clearHistory()
{
int channels = inArray.length;
for (int c=0; c<channels; c++)
{
for (int i=0; i<HISTORYSIZE; i++)
{
inArray[c][i] = outArray[c][i] = 0f;
}
}
}
|
[
"public",
"void",
"clearHistory",
"(",
")",
"{",
"int",
"channels",
"=",
"inArray",
".",
"length",
";",
"for",
"(",
"int",
"c",
"=",
"0",
";",
"c",
"<",
"channels",
";",
"c",
"++",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"HISTORYSIZE",
";",
"i",
"++",
")",
"{",
"inArray",
"[",
"c",
"]",
"[",
"i",
"]",
"=",
"outArray",
"[",
"c",
"]",
"[",
"i",
"]",
"=",
"0f",
";",
"}",
"}",
"}"
] |
Clean the history
@since 14.01.2012
|
[
"Clean",
"the",
"history"
] |
cda4fe943a589dc49415f4413453e2eece72076a
|
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/javamod/mixer/dsp/iir/filter/IIRFilterBase.java#L95-L105
|
150,654
|
jtrfp/javamod
|
src/main/java/de/quippy/mp3/decoder/Header.java
|
Header.calculate_framesize
|
public int calculate_framesize()
{
if (h_layer == 1)
{
framesize = (12 * bitrates[h_version][0][h_bitrate_index]) /
frequencies[h_version][h_sample_frequency];
if (h_padding_bit != 0 ) framesize++;
framesize <<= 2; // one slot is 4 bytes long
nSlots = 0;
}
else
{
framesize = (144 * bitrates[h_version][h_layer - 1][h_bitrate_index]) /
frequencies[h_version][h_sample_frequency];
if (h_version == MPEG2_LSF || h_version == MPEG25_LSF) framesize >>= 1; // SZD
if (h_padding_bit != 0) framesize++;
// Layer III slots
if (h_layer == 3)
{
if (h_version == MPEG1)
{
nSlots = framesize - ((h_mode == SINGLE_CHANNEL) ? 17 : 32) // side info size
- ((h_protection_bit!=0) ? 0 : 2) // CRC size
- 4; // header size
}
else
{ // MPEG-2 LSF, SZD: MPEG-2.5 LSF
nSlots = framesize - ((h_mode == SINGLE_CHANNEL) ? 9 : 17) // side info size
- ((h_protection_bit!=0) ? 0 : 2) // CRC size
- 4; // header size
}
}
else
{
nSlots = 0;
}
}
framesize -= 4; // subtract header size
return framesize;
}
|
java
|
public int calculate_framesize()
{
if (h_layer == 1)
{
framesize = (12 * bitrates[h_version][0][h_bitrate_index]) /
frequencies[h_version][h_sample_frequency];
if (h_padding_bit != 0 ) framesize++;
framesize <<= 2; // one slot is 4 bytes long
nSlots = 0;
}
else
{
framesize = (144 * bitrates[h_version][h_layer - 1][h_bitrate_index]) /
frequencies[h_version][h_sample_frequency];
if (h_version == MPEG2_LSF || h_version == MPEG25_LSF) framesize >>= 1; // SZD
if (h_padding_bit != 0) framesize++;
// Layer III slots
if (h_layer == 3)
{
if (h_version == MPEG1)
{
nSlots = framesize - ((h_mode == SINGLE_CHANNEL) ? 17 : 32) // side info size
- ((h_protection_bit!=0) ? 0 : 2) // CRC size
- 4; // header size
}
else
{ // MPEG-2 LSF, SZD: MPEG-2.5 LSF
nSlots = framesize - ((h_mode == SINGLE_CHANNEL) ? 9 : 17) // side info size
- ((h_protection_bit!=0) ? 0 : 2) // CRC size
- 4; // header size
}
}
else
{
nSlots = 0;
}
}
framesize -= 4; // subtract header size
return framesize;
}
|
[
"public",
"int",
"calculate_framesize",
"(",
")",
"{",
"if",
"(",
"h_layer",
"==",
"1",
")",
"{",
"framesize",
"=",
"(",
"12",
"*",
"bitrates",
"[",
"h_version",
"]",
"[",
"0",
"]",
"[",
"h_bitrate_index",
"]",
")",
"/",
"frequencies",
"[",
"h_version",
"]",
"[",
"h_sample_frequency",
"]",
";",
"if",
"(",
"h_padding_bit",
"!=",
"0",
")",
"framesize",
"++",
";",
"framesize",
"<<=",
"2",
";",
"// one slot is 4 bytes long",
"nSlots",
"=",
"0",
";",
"}",
"else",
"{",
"framesize",
"=",
"(",
"144",
"*",
"bitrates",
"[",
"h_version",
"]",
"[",
"h_layer",
"-",
"1",
"]",
"[",
"h_bitrate_index",
"]",
")",
"/",
"frequencies",
"[",
"h_version",
"]",
"[",
"h_sample_frequency",
"]",
";",
"if",
"(",
"h_version",
"==",
"MPEG2_LSF",
"||",
"h_version",
"==",
"MPEG25_LSF",
")",
"framesize",
">>=",
"1",
";",
"// SZD",
"if",
"(",
"h_padding_bit",
"!=",
"0",
")",
"framesize",
"++",
";",
"// Layer III slots",
"if",
"(",
"h_layer",
"==",
"3",
")",
"{",
"if",
"(",
"h_version",
"==",
"MPEG1",
")",
"{",
"nSlots",
"=",
"framesize",
"-",
"(",
"(",
"h_mode",
"==",
"SINGLE_CHANNEL",
")",
"?",
"17",
":",
"32",
")",
"// side info size",
"-",
"(",
"(",
"h_protection_bit",
"!=",
"0",
")",
"?",
"0",
":",
"2",
")",
"// CRC size",
"-",
"4",
";",
"// header size",
"}",
"else",
"{",
"// MPEG-2 LSF, SZD: MPEG-2.5 LSF",
"nSlots",
"=",
"framesize",
"-",
"(",
"(",
"h_mode",
"==",
"SINGLE_CHANNEL",
")",
"?",
"9",
":",
"17",
")",
"// side info size",
"-",
"(",
"(",
"h_protection_bit",
"!=",
"0",
")",
"?",
"0",
":",
"2",
")",
"// CRC size",
"-",
"4",
";",
"// header size",
"}",
"}",
"else",
"{",
"nSlots",
"=",
"0",
";",
"}",
"}",
"framesize",
"-=",
"4",
";",
"// subtract header size",
"return",
"framesize",
";",
"}"
] |
Calculate Frame size.
Calculates framesize in bytes excluding header size.
|
[
"Calculate",
"Frame",
"size",
".",
"Calculates",
"framesize",
"in",
"bytes",
"excluding",
"header",
"size",
"."
] |
cda4fe943a589dc49415f4413453e2eece72076a
|
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/mp3/decoder/Header.java#L462-L502
|
150,655
|
jtrfp/javamod
|
src/main/java/de/quippy/jflac/FrameListeners.java
|
FrameListeners.processMetadata
|
public void processMetadata(Metadata metadata) {
synchronized (frameListeners) {
Iterator<FrameListener> it = frameListeners.iterator();
while (it.hasNext()) {
FrameListener listener = it.next();
listener.processMetadata(metadata);
}
}
}
|
java
|
public void processMetadata(Metadata metadata) {
synchronized (frameListeners) {
Iterator<FrameListener> it = frameListeners.iterator();
while (it.hasNext()) {
FrameListener listener = it.next();
listener.processMetadata(metadata);
}
}
}
|
[
"public",
"void",
"processMetadata",
"(",
"Metadata",
"metadata",
")",
"{",
"synchronized",
"(",
"frameListeners",
")",
"{",
"Iterator",
"<",
"FrameListener",
">",
"it",
"=",
"frameListeners",
".",
"iterator",
"(",
")",
";",
"while",
"(",
"it",
".",
"hasNext",
"(",
")",
")",
"{",
"FrameListener",
"listener",
"=",
"it",
".",
"next",
"(",
")",
";",
"listener",
".",
"processMetadata",
"(",
"metadata",
")",
";",
"}",
"}",
"}"
] |
Process metadata records.
@param metadata the metadata block
@see de.quippy.jflac.FrameListener#processMetadata(de.quippy.jflac.metadata.MetadataBase)
|
[
"Process",
"metadata",
"records",
"."
] |
cda4fe943a589dc49415f4413453e2eece72076a
|
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/jflac/FrameListeners.java#L48-L56
|
150,656
|
jtrfp/javamod
|
src/main/java/de/quippy/jflac/FrameListeners.java
|
FrameListeners.processFrame
|
public void processFrame(Frame frame) {
synchronized (frameListeners) {
Iterator<FrameListener> it = frameListeners.iterator();
while (it.hasNext()) {
FrameListener listener = it.next();
listener.processFrame(frame);
}
}
}
|
java
|
public void processFrame(Frame frame) {
synchronized (frameListeners) {
Iterator<FrameListener> it = frameListeners.iterator();
while (it.hasNext()) {
FrameListener listener = it.next();
listener.processFrame(frame);
}
}
}
|
[
"public",
"void",
"processFrame",
"(",
"Frame",
"frame",
")",
"{",
"synchronized",
"(",
"frameListeners",
")",
"{",
"Iterator",
"<",
"FrameListener",
">",
"it",
"=",
"frameListeners",
".",
"iterator",
"(",
")",
";",
"while",
"(",
"it",
".",
"hasNext",
"(",
")",
")",
"{",
"FrameListener",
"listener",
"=",
"it",
".",
"next",
"(",
")",
";",
"listener",
".",
"processFrame",
"(",
"frame",
")",
";",
"}",
"}",
"}"
] |
Process data frames.
@param frame the data frame
@see de.quippy.jflac.FrameListener#processFrame(de.quippy.jflac.frame.Frame)
|
[
"Process",
"data",
"frames",
"."
] |
cda4fe943a589dc49415f4413453e2eece72076a
|
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/jflac/FrameListeners.java#L63-L71
|
150,657
|
jtrfp/javamod
|
src/main/java/de/quippy/jflac/FrameListeners.java
|
FrameListeners.processError
|
public void processError(String msg) {
synchronized (frameListeners) {
Iterator<FrameListener> it = frameListeners.iterator();
while (it.hasNext()) {
FrameListener listener = it.next();
listener.processError(msg);
}
}
}
|
java
|
public void processError(String msg) {
synchronized (frameListeners) {
Iterator<FrameListener> it = frameListeners.iterator();
while (it.hasNext()) {
FrameListener listener = it.next();
listener.processError(msg);
}
}
}
|
[
"public",
"void",
"processError",
"(",
"String",
"msg",
")",
"{",
"synchronized",
"(",
"frameListeners",
")",
"{",
"Iterator",
"<",
"FrameListener",
">",
"it",
"=",
"frameListeners",
".",
"iterator",
"(",
")",
";",
"while",
"(",
"it",
".",
"hasNext",
"(",
")",
")",
"{",
"FrameListener",
"listener",
"=",
"it",
".",
"next",
"(",
")",
";",
"listener",
".",
"processError",
"(",
"msg",
")",
";",
"}",
"}",
"}"
] |
Called for each frame error detected.
@param msg The error message
@see de.quippy.jflac.FrameListener#processError(java.lang.String)
|
[
"Called",
"for",
"each",
"frame",
"error",
"detected",
"."
] |
cda4fe943a589dc49415f4413453e2eece72076a
|
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/jflac/FrameListeners.java#L78-L86
|
150,658
|
jtrfp/javamod
|
src/main/java/de/quippy/javamod/main/gui/components/SAMeterPanel.java
|
SAMeterPanel.setMeter
|
public void setMeter(float [] newSamples)
{
if (newSamples!=null)
{
anzSamples = newSamples.length;
if (floatSamples==null || floatSamples.length != anzSamples) floatSamples = new float[anzSamples];
System.arraycopy(newSamples, 0, floatSamples, 0, anzSamples);
float [] resultFFTSamples = fftCalc.calculate(floatSamples);
for (int a=0, bd=0; bd<bands; a+=multiplier, bd++)
{
float wFs = resultFFTSamples[a];
for (int b=1; b<multiplier; b++) wFs+=resultFFTSamples[a+b];
wFs *= (float)FastMath.log(bd + 2);
if (wFs > 1.0F) wFs = 1.0F;
if (wFs>fftLevels[bd])
{
fftLevels[bd]=wFs;
if (fftLevels[bd]>maxFFTLevels[bd])
{
maxFFTLevels[bd] = fftLevels[bd];
maxPeakLevelRampDownValue[bd] = maxPeakLevelRampDownDelay;
}
}
}
}
else
{
floatSamples=null;
}
}
|
java
|
public void setMeter(float [] newSamples)
{
if (newSamples!=null)
{
anzSamples = newSamples.length;
if (floatSamples==null || floatSamples.length != anzSamples) floatSamples = new float[anzSamples];
System.arraycopy(newSamples, 0, floatSamples, 0, anzSamples);
float [] resultFFTSamples = fftCalc.calculate(floatSamples);
for (int a=0, bd=0; bd<bands; a+=multiplier, bd++)
{
float wFs = resultFFTSamples[a];
for (int b=1; b<multiplier; b++) wFs+=resultFFTSamples[a+b];
wFs *= (float)FastMath.log(bd + 2);
if (wFs > 1.0F) wFs = 1.0F;
if (wFs>fftLevels[bd])
{
fftLevels[bd]=wFs;
if (fftLevels[bd]>maxFFTLevels[bd])
{
maxFFTLevels[bd] = fftLevels[bd];
maxPeakLevelRampDownValue[bd] = maxPeakLevelRampDownDelay;
}
}
}
}
else
{
floatSamples=null;
}
}
|
[
"public",
"void",
"setMeter",
"(",
"float",
"[",
"]",
"newSamples",
")",
"{",
"if",
"(",
"newSamples",
"!=",
"null",
")",
"{",
"anzSamples",
"=",
"newSamples",
".",
"length",
";",
"if",
"(",
"floatSamples",
"==",
"null",
"||",
"floatSamples",
".",
"length",
"!=",
"anzSamples",
")",
"floatSamples",
"=",
"new",
"float",
"[",
"anzSamples",
"]",
";",
"System",
".",
"arraycopy",
"(",
"newSamples",
",",
"0",
",",
"floatSamples",
",",
"0",
",",
"anzSamples",
")",
";",
"float",
"[",
"]",
"resultFFTSamples",
"=",
"fftCalc",
".",
"calculate",
"(",
"floatSamples",
")",
";",
"for",
"(",
"int",
"a",
"=",
"0",
",",
"bd",
"=",
"0",
";",
"bd",
"<",
"bands",
";",
"a",
"+=",
"multiplier",
",",
"bd",
"++",
")",
"{",
"float",
"wFs",
"=",
"resultFFTSamples",
"[",
"a",
"]",
";",
"for",
"(",
"int",
"b",
"=",
"1",
";",
"b",
"<",
"multiplier",
";",
"b",
"++",
")",
"wFs",
"+=",
"resultFFTSamples",
"[",
"+",
"]",
";",
"wFs",
"*=",
"(",
"float",
")",
"FastMath",
".",
"log",
"(",
"bd",
"+",
"2",
")",
";",
"if",
"(",
"wFs",
">",
"1.0F",
")",
"wFs",
"=",
"1.0F",
";",
"if",
"(",
"wFs",
">",
"fftLevels",
"[",
"bd",
"]",
")",
"{",
"fftLevels",
"[",
"bd",
"]",
"=",
"wFs",
";",
"if",
"(",
"fftLevels",
"[",
"bd",
"]",
">",
"maxFFTLevels",
"[",
"bd",
"]",
")",
"{",
"maxFFTLevels",
"[",
"bd",
"]",
"=",
"fftLevels",
"[",
"bd",
"]",
";",
"maxPeakLevelRampDownValue",
"[",
"bd",
"]",
"=",
"maxPeakLevelRampDownDelay",
";",
"}",
"}",
"}",
"}",
"else",
"{",
"floatSamples",
"=",
"null",
";",
"}",
"}"
] |
Will set new Values
@since 06.10.2007
@param newSamples
|
[
"Will",
"set",
"new",
"Values"
] |
cda4fe943a589dc49415f4413453e2eece72076a
|
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/javamod/main/gui/components/SAMeterPanel.java#L164-L196
|
150,659
|
jtrfp/javamod
|
src/main/java/de/quippy/javamod/main/gui/components/SAMeterPanel.java
|
SAMeterPanel.drawMeter
|
protected void drawMeter(Graphics g, int newTop, int newLeft, int newWidth, int newHeight, boolean doClear)
{
if (g!=null)
{
switch (drawWhat)
{
default:
case DRAW_SA_METER: drawSAMeter(g, newTop, newLeft, newWidth, newHeight, doClear); break;
case DRAW_WAVE_METER: drawWaveMeter(g, newTop, newLeft, newWidth, newHeight, doClear); break;
case DRAW_SK_METER: drawSKMeter(g, newTop, newLeft, newWidth, newHeight); break;
}
}
for (int i=0; i<bands; i++)
{
fftLevels[i]-=rampDownValue;
if (fftLevels[i]<0.0F) fftLevels[i]=0.0F;
maxFFTLevels[i] -= maxPeakLevelRampDownValue[i];
if (maxFFTLevels[i]<0.0F)
maxFFTLevels[i]=0.0F;
else
maxPeakLevelRampDownValue[i] += maxPeakLevelRampDownDelay;
}
}
|
java
|
protected void drawMeter(Graphics g, int newTop, int newLeft, int newWidth, int newHeight, boolean doClear)
{
if (g!=null)
{
switch (drawWhat)
{
default:
case DRAW_SA_METER: drawSAMeter(g, newTop, newLeft, newWidth, newHeight, doClear); break;
case DRAW_WAVE_METER: drawWaveMeter(g, newTop, newLeft, newWidth, newHeight, doClear); break;
case DRAW_SK_METER: drawSKMeter(g, newTop, newLeft, newWidth, newHeight); break;
}
}
for (int i=0; i<bands; i++)
{
fftLevels[i]-=rampDownValue;
if (fftLevels[i]<0.0F) fftLevels[i]=0.0F;
maxFFTLevels[i] -= maxPeakLevelRampDownValue[i];
if (maxFFTLevels[i]<0.0F)
maxFFTLevels[i]=0.0F;
else
maxPeakLevelRampDownValue[i] += maxPeakLevelRampDownDelay;
}
}
|
[
"protected",
"void",
"drawMeter",
"(",
"Graphics",
"g",
",",
"int",
"newTop",
",",
"int",
"newLeft",
",",
"int",
"newWidth",
",",
"int",
"newHeight",
",",
"boolean",
"doClear",
")",
"{",
"if",
"(",
"g",
"!=",
"null",
")",
"{",
"switch",
"(",
"drawWhat",
")",
"{",
"default",
":",
"case",
"DRAW_SA_METER",
":",
"drawSAMeter",
"(",
"g",
",",
"newTop",
",",
"newLeft",
",",
"newWidth",
",",
"newHeight",
",",
"doClear",
")",
";",
"break",
";",
"case",
"DRAW_WAVE_METER",
":",
"drawWaveMeter",
"(",
"g",
",",
"newTop",
",",
"newLeft",
",",
"newWidth",
",",
"newHeight",
",",
"doClear",
")",
";",
"break",
";",
"case",
"DRAW_SK_METER",
":",
"drawSKMeter",
"(",
"g",
",",
"newTop",
",",
"newLeft",
",",
"newWidth",
",",
"newHeight",
")",
";",
"break",
";",
"}",
"}",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"bands",
";",
"i",
"++",
")",
"{",
"fftLevels",
"[",
"i",
"]",
"-=",
"rampDownValue",
";",
"if",
"(",
"fftLevels",
"[",
"i",
"]",
"<",
"0.0F",
")",
"fftLevels",
"[",
"i",
"]",
"=",
"0.0F",
";",
"maxFFTLevels",
"[",
"i",
"]",
"-=",
"maxPeakLevelRampDownValue",
"[",
"i",
"]",
";",
"if",
"(",
"maxFFTLevels",
"[",
"i",
"]",
"<",
"0.0F",
")",
"maxFFTLevels",
"[",
"i",
"]",
"=",
"0.0F",
";",
"else",
"maxPeakLevelRampDownValue",
"[",
"i",
"]",
"+=",
"maxPeakLevelRampDownDelay",
";",
"}",
"}"
] |
Internal method doing the drawing
@param g
@param newTop
@param newLeft
@param newWidth
@param newHeight
@param doClear
@since 06.05.2011
|
[
"Internal",
"method",
"doing",
"the",
"drawing"
] |
cda4fe943a589dc49415f4413453e2eece72076a
|
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/javamod/main/gui/components/SAMeterPanel.java#L215-L238
|
150,660
|
jtrfp/javamod
|
src/main/java/de/quippy/javamod/multimedia/mod/loader/tracker/XMMod.java
|
XMMod.isXMMod
|
private boolean isXMMod(String kennung)
{
if (kennung.equals("Extended Module: ")) return true;
if (kennung.toLowerCase().equals("extended module: ")) return true;
return false;
}
|
java
|
private boolean isXMMod(String kennung)
{
if (kennung.equals("Extended Module: ")) return true;
if (kennung.toLowerCase().equals("extended module: ")) return true;
return false;
}
|
[
"private",
"boolean",
"isXMMod",
"(",
"String",
"kennung",
")",
"{",
"if",
"(",
"kennung",
".",
"equals",
"(",
"\"Extended Module: \"",
")",
")",
"return",
"true",
";",
"if",
"(",
"kennung",
".",
"toLowerCase",
"(",
")",
".",
"equals",
"(",
"\"extended module: \"",
")",
")",
"return",
"true",
";",
"return",
"false",
";",
"}"
] |
Get the ModType
@param kennung
@return
|
[
"Get",
"the",
"ModType"
] |
cda4fe943a589dc49415f4413453e2eece72076a
|
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/javamod/multimedia/mod/loader/tracker/XMMod.java#L150-L155
|
150,661
|
adamfisk/dnsjava-fork
|
src/org/xbill/DNS/DNSSEC.java
|
DNSSEC.algString
|
public static String
algString(int alg) throws UnsupportedAlgorithmException {
switch (alg) {
case Algorithm.RSAMD5:
return "MD5withRSA";
case Algorithm.DSA:
case Algorithm.DSA_NSEC3_SHA1:
return "SHA1withDSA";
case Algorithm.RSASHA1:
case Algorithm.RSA_NSEC3_SHA1:
return "SHA1withRSA";
case Algorithm.RSASHA256:
return "SHA256withRSA";
case Algorithm.RSASHA512:
return "SHA512withRSA";
default:
throw new UnsupportedAlgorithmException(alg);
}
}
|
java
|
public static String
algString(int alg) throws UnsupportedAlgorithmException {
switch (alg) {
case Algorithm.RSAMD5:
return "MD5withRSA";
case Algorithm.DSA:
case Algorithm.DSA_NSEC3_SHA1:
return "SHA1withDSA";
case Algorithm.RSASHA1:
case Algorithm.RSA_NSEC3_SHA1:
return "SHA1withRSA";
case Algorithm.RSASHA256:
return "SHA256withRSA";
case Algorithm.RSASHA512:
return "SHA512withRSA";
default:
throw new UnsupportedAlgorithmException(alg);
}
}
|
[
"public",
"static",
"String",
"algString",
"(",
"int",
"alg",
")",
"throws",
"UnsupportedAlgorithmException",
"{",
"switch",
"(",
"alg",
")",
"{",
"case",
"Algorithm",
".",
"RSAMD5",
":",
"return",
"\"MD5withRSA\"",
";",
"case",
"Algorithm",
".",
"DSA",
":",
"case",
"Algorithm",
".",
"DSA_NSEC3_SHA1",
":",
"return",
"\"SHA1withDSA\"",
";",
"case",
"Algorithm",
".",
"RSASHA1",
":",
"case",
"Algorithm",
".",
"RSA_NSEC3_SHA1",
":",
"return",
"\"SHA1withRSA\"",
";",
"case",
"Algorithm",
".",
"RSASHA256",
":",
"return",
"\"SHA256withRSA\"",
";",
"case",
"Algorithm",
".",
"RSASHA512",
":",
"return",
"\"SHA512withRSA\"",
";",
"default",
":",
"throw",
"new",
"UnsupportedAlgorithmException",
"(",
"alg",
")",
";",
"}",
"}"
] |
Convert an algorithm number to the corresponding JCA string.
@param alg The algorithm number.
@throws UnsupportedAlgorithmException The algorithm is unknown.
|
[
"Convert",
"an",
"algorithm",
"number",
"to",
"the",
"corresponding",
"JCA",
"string",
"."
] |
69510a1cad0518badb19a6615724313bebc61f90
|
https://github.com/adamfisk/dnsjava-fork/blob/69510a1cad0518badb19a6615724313bebc61f90/src/org/xbill/DNS/DNSSEC.java#L465-L483
|
150,662
|
jpaoletti/java-presentation-manager
|
modules/jpm-core/src/main/java/jpaoletti/jpm/util/Validator.java
|
Validator.matches
|
public static boolean matches(String pattern, String value) {
Pattern p = Pattern.compile(pattern);
Matcher m = p.matcher(value);
return m.matches();
}
|
java
|
public static boolean matches(String pattern, String value) {
Pattern p = Pattern.compile(pattern);
Matcher m = p.matcher(value);
return m.matches();
}
|
[
"public",
"static",
"boolean",
"matches",
"(",
"String",
"pattern",
",",
"String",
"value",
")",
"{",
"Pattern",
"p",
"=",
"Pattern",
".",
"compile",
"(",
"pattern",
")",
";",
"Matcher",
"m",
"=",
"p",
".",
"matcher",
"(",
"value",
")",
";",
"return",
"m",
".",
"matches",
"(",
")",
";",
"}"
] |
Validate if the given value matches the pattern
@param pattern The pattern
@param value The value
@return true if value matches pattern
|
[
"Validate",
"if",
"the",
"given",
"value",
"matches",
"the",
"pattern"
] |
d5aab55638383695db244744b4bfe27c5200e04f
|
https://github.com/jpaoletti/java-presentation-manager/blob/d5aab55638383695db244744b4bfe27c5200e04f/modules/jpm-core/src/main/java/jpaoletti/jpm/util/Validator.java#L46-L50
|
150,663
|
jpaoletti/java-presentation-manager
|
modules/jpm-core/src/main/java/jpaoletti/jpm/util/Validator.java
|
Validator.isLong
|
public static boolean isLong(String s) {
if (s == null) {
return false;
}
try {
Long.parseLong(s.trim());
} catch (NumberFormatException e) {
return false;
}
return true;
}
|
java
|
public static boolean isLong(String s) {
if (s == null) {
return false;
}
try {
Long.parseLong(s.trim());
} catch (NumberFormatException e) {
return false;
}
return true;
}
|
[
"public",
"static",
"boolean",
"isLong",
"(",
"String",
"s",
")",
"{",
"if",
"(",
"s",
"==",
"null",
")",
"{",
"return",
"false",
";",
"}",
"try",
"{",
"Long",
".",
"parseLong",
"(",
"s",
".",
"trim",
"(",
")",
")",
";",
"}",
"catch",
"(",
"NumberFormatException",
"e",
")",
"{",
"return",
"false",
";",
"}",
"return",
"true",
";",
"}"
] |
Validate if the given string is a long
@param s
@return
|
[
"Validate",
"if",
"the",
"given",
"string",
"is",
"a",
"long"
] |
d5aab55638383695db244744b4bfe27c5200e04f
|
https://github.com/jpaoletti/java-presentation-manager/blob/d5aab55638383695db244744b4bfe27c5200e04f/modules/jpm-core/src/main/java/jpaoletti/jpm/util/Validator.java#L103-L113
|
150,664
|
GerdHolz/TOVAL
|
src/de/invation/code/toval/misc/CollectionUtils.java
|
CollectionUtils.containsNo
|
public static <T> boolean containsNo(Collection<T> baseList, Collection<T> valueList) {
for (T v : valueList) {
if (baseList.contains(v)) {
return false;
}
}
return true;
}
|
java
|
public static <T> boolean containsNo(Collection<T> baseList, Collection<T> valueList) {
for (T v : valueList) {
if (baseList.contains(v)) {
return false;
}
}
return true;
}
|
[
"public",
"static",
"<",
"T",
">",
"boolean",
"containsNo",
"(",
"Collection",
"<",
"T",
">",
"baseList",
",",
"Collection",
"<",
"T",
">",
"valueList",
")",
"{",
"for",
"(",
"T",
"v",
":",
"valueList",
")",
"{",
"if",
"(",
"baseList",
".",
"contains",
"(",
"v",
")",
")",
"{",
"return",
"false",
";",
"}",
"}",
"return",
"true",
";",
"}"
] |
Checks if the given basic list contains any element of the given value
list.
@param <T>
Type of collection elements
@param baseList
List to check for occurrences
@param valueList
Values to search
@return <code>true</code> if <code>baseList</code> contains any element
of <code>valueList</code>; <code>false</code> otherwise
|
[
"Checks",
"if",
"the",
"given",
"basic",
"list",
"contains",
"any",
"element",
"of",
"the",
"given",
"value",
"list",
"."
] |
036922cdfd710fa53b18e5dbe1e07f226f731fde
|
https://github.com/GerdHolz/TOVAL/blob/036922cdfd710fa53b18e5dbe1e07f226f731fde/src/de/invation/code/toval/misc/CollectionUtils.java#L45-L52
|
150,665
|
hawkular/hawkular-inventory
|
hawkular-inventory-impl-tinkerpop-parent/hawkular-inventory-impl-tinkerpop/src/main/java/org/hawkular/inventory/impl/tinkerpop/FilterVisitor.java
|
FilterVisitor.toInteger
|
private static Integer toInteger(String str) {
char[] chars = str.toCharArray();
int result = 0;
int multiplier = 1;
for (int i = chars.length - 1; i >= 0; --i, multiplier *= 10) {
char c = chars[i];
if ('0' <= c && c <= '9') {
result += (c - '0') * multiplier;
} else {
return null;
}
}
return result;
}
|
java
|
private static Integer toInteger(String str) {
char[] chars = str.toCharArray();
int result = 0;
int multiplier = 1;
for (int i = chars.length - 1; i >= 0; --i, multiplier *= 10) {
char c = chars[i];
if ('0' <= c && c <= '9') {
result += (c - '0') * multiplier;
} else {
return null;
}
}
return result;
}
|
[
"private",
"static",
"Integer",
"toInteger",
"(",
"String",
"str",
")",
"{",
"char",
"[",
"]",
"chars",
"=",
"str",
".",
"toCharArray",
"(",
")",
";",
"int",
"result",
"=",
"0",
";",
"int",
"multiplier",
"=",
"1",
";",
"for",
"(",
"int",
"i",
"=",
"chars",
".",
"length",
"-",
"1",
";",
"i",
">=",
"0",
";",
"--",
"i",
",",
"multiplier",
"*=",
"10",
")",
"{",
"char",
"c",
"=",
"chars",
"[",
"i",
"]",
";",
"if",
"(",
"'",
"'",
"<=",
"c",
"&&",
"c",
"<=",
"'",
"'",
")",
"{",
"result",
"+=",
"(",
"c",
"-",
"'",
"'",
")",
"*",
"multiplier",
";",
"}",
"else",
"{",
"return",
"null",
";",
"}",
"}",
"return",
"result",
";",
"}"
] |
A very simplistic conversion of string to positive integer in only decimal radix.
<p>This is used to figure out whether a segment id represents an index or a key.
@param str the string potentially representing a number
@return the parsed number or null if the string is not a supported number
|
[
"A",
"very",
"simplistic",
"conversion",
"of",
"string",
"to",
"positive",
"integer",
"in",
"only",
"decimal",
"radix",
"."
] |
f56dc10323dca21777feb5b609a9e9cc70ffaf62
|
https://github.com/hawkular/hawkular-inventory/blob/f56dc10323dca21777feb5b609a9e9cc70ffaf62/hawkular-inventory-impl-tinkerpop-parent/hawkular-inventory-impl-tinkerpop/src/main/java/org/hawkular/inventory/impl/tinkerpop/FilterVisitor.java#L573-L589
|
150,666
|
vdmeer/skb-java-base
|
src/main/java/de/vandermeer/skb/base/shell/LineParser.java
|
LineParser.getToken
|
public String getToken(){
if(this.tokenPosition>0){
String[] ar = StringUtils.split(this.line, null, this.tokenPosition+1);
if(ar!=null && ar.length>(this.tokenPosition-1)){
return StringUtils.trim(ar[this.tokenPosition-1]);
}
}
return null;
}
|
java
|
public String getToken(){
if(this.tokenPosition>0){
String[] ar = StringUtils.split(this.line, null, this.tokenPosition+1);
if(ar!=null && ar.length>(this.tokenPosition-1)){
return StringUtils.trim(ar[this.tokenPosition-1]);
}
}
return null;
}
|
[
"public",
"String",
"getToken",
"(",
")",
"{",
"if",
"(",
"this",
".",
"tokenPosition",
">",
"0",
")",
"{",
"String",
"[",
"]",
"ar",
"=",
"StringUtils",
".",
"split",
"(",
"this",
".",
"line",
",",
"null",
",",
"this",
".",
"tokenPosition",
"+",
"1",
")",
";",
"if",
"(",
"ar",
"!=",
"null",
"&&",
"ar",
".",
"length",
">",
"(",
"this",
".",
"tokenPosition",
"-",
"1",
")",
")",
"{",
"return",
"StringUtils",
".",
"trim",
"(",
"ar",
"[",
"this",
".",
"tokenPosition",
"-",
"1",
"]",
")",
";",
"}",
"}",
"return",
"null",
";",
"}"
] |
Returns an array of all tokens being parsed.
@return token array
|
[
"Returns",
"an",
"array",
"of",
"all",
"tokens",
"being",
"parsed",
"."
] |
6d845bcc482aa9344d016e80c0c3455aeae13a13
|
https://github.com/vdmeer/skb-java-base/blob/6d845bcc482aa9344d016e80c0c3455aeae13a13/src/main/java/de/vandermeer/skb/base/shell/LineParser.java#L71-L79
|
150,667
|
vdmeer/skb-java-base
|
src/main/java/de/vandermeer/skb/base/shell/LineParser.java
|
LineParser.getArgs
|
public String getArgs(){
int count = (this.tokenPosition==0)?1:this.tokenPosition+1;
String[] ar = StringUtils.split(this.line, null, count);
if(ar!=null && ar.length>(this.tokenPosition)){
return StringUtils.trim(ar[this.tokenPosition]);
}
return null;
}
|
java
|
public String getArgs(){
int count = (this.tokenPosition==0)?1:this.tokenPosition+1;
String[] ar = StringUtils.split(this.line, null, count);
if(ar!=null && ar.length>(this.tokenPosition)){
return StringUtils.trim(ar[this.tokenPosition]);
}
return null;
}
|
[
"public",
"String",
"getArgs",
"(",
")",
"{",
"int",
"count",
"=",
"(",
"this",
".",
"tokenPosition",
"==",
"0",
")",
"?",
"1",
":",
"this",
".",
"tokenPosition",
"+",
"1",
";",
"String",
"[",
"]",
"ar",
"=",
"StringUtils",
".",
"split",
"(",
"this",
".",
"line",
",",
"null",
",",
"count",
")",
";",
"if",
"(",
"ar",
"!=",
"null",
"&&",
"ar",
".",
"length",
">",
"(",
"this",
".",
"tokenPosition",
")",
")",
"{",
"return",
"StringUtils",
".",
"trim",
"(",
"ar",
"[",
"this",
".",
"tokenPosition",
"]",
")",
";",
"}",
"return",
"null",
";",
"}"
] |
Returns an string of all tokens that can be considered being command arguments, using the current token position.
@return argument string
|
[
"Returns",
"an",
"string",
"of",
"all",
"tokens",
"that",
"can",
"be",
"considered",
"being",
"command",
"arguments",
"using",
"the",
"current",
"token",
"position",
"."
] |
6d845bcc482aa9344d016e80c0c3455aeae13a13
|
https://github.com/vdmeer/skb-java-base/blob/6d845bcc482aa9344d016e80c0c3455aeae13a13/src/main/java/de/vandermeer/skb/base/shell/LineParser.java#L85-L92
|
150,668
|
vdmeer/skb-java-base
|
src/main/java/de/vandermeer/skb/base/shell/LineParser.java
|
LineParser.getArgList
|
public ArrayList<String> getArgList(){
ArrayList<String> ret = new ArrayList<String>();
String[] ar = StringUtils.split(this.getArgs());
if(ar!=null){
for(String s : ar){
ret.add(StringUtils.trim(s));
}
}
return ret;
}
|
java
|
public ArrayList<String> getArgList(){
ArrayList<String> ret = new ArrayList<String>();
String[] ar = StringUtils.split(this.getArgs());
if(ar!=null){
for(String s : ar){
ret.add(StringUtils.trim(s));
}
}
return ret;
}
|
[
"public",
"ArrayList",
"<",
"String",
">",
"getArgList",
"(",
")",
"{",
"ArrayList",
"<",
"String",
">",
"ret",
"=",
"new",
"ArrayList",
"<",
"String",
">",
"(",
")",
";",
"String",
"[",
"]",
"ar",
"=",
"StringUtils",
".",
"split",
"(",
"this",
".",
"getArgs",
"(",
")",
")",
";",
"if",
"(",
"ar",
"!=",
"null",
")",
"{",
"for",
"(",
"String",
"s",
":",
"ar",
")",
"{",
"ret",
".",
"add",
"(",
"StringUtils",
".",
"trim",
"(",
"s",
")",
")",
";",
"}",
"}",
"return",
"ret",
";",
"}"
] |
Returns a list of all tokens that can be considered being command arguments, using the current token position.
@return argument list
|
[
"Returns",
"a",
"list",
"of",
"all",
"tokens",
"that",
"can",
"be",
"considered",
"being",
"command",
"arguments",
"using",
"the",
"current",
"token",
"position",
"."
] |
6d845bcc482aa9344d016e80c0c3455aeae13a13
|
https://github.com/vdmeer/skb-java-base/blob/6d845bcc482aa9344d016e80c0c3455aeae13a13/src/main/java/de/vandermeer/skb/base/shell/LineParser.java#L98-L107
|
150,669
|
vdmeer/skb-java-base
|
src/main/java/de/vandermeer/skb/base/shell/LineParser.java
|
LineParser.getArgMap
|
public Map<String, String> getArgMap(){
Map<String, String> ret = new LinkedHashMap<String, String>();
String[] ar = StringUtils.split(this.getArgs(), ',');
if(ar!=null){
for(String s : ar){
String[] kv = StringUtils.split(s, ":", 2);
if(kv!=null && kv.length==2){
ret.put(StringUtils.trim(kv[0]), StringUtils.trim(kv[1]));
}
else{
//TODO error log?
}
}
}
return ret;
}
|
java
|
public Map<String, String> getArgMap(){
Map<String, String> ret = new LinkedHashMap<String, String>();
String[] ar = StringUtils.split(this.getArgs(), ',');
if(ar!=null){
for(String s : ar){
String[] kv = StringUtils.split(s, ":", 2);
if(kv!=null && kv.length==2){
ret.put(StringUtils.trim(kv[0]), StringUtils.trim(kv[1]));
}
else{
//TODO error log?
}
}
}
return ret;
}
|
[
"public",
"Map",
"<",
"String",
",",
"String",
">",
"getArgMap",
"(",
")",
"{",
"Map",
"<",
"String",
",",
"String",
">",
"ret",
"=",
"new",
"LinkedHashMap",
"<",
"String",
",",
"String",
">",
"(",
")",
";",
"String",
"[",
"]",
"ar",
"=",
"StringUtils",
".",
"split",
"(",
"this",
".",
"getArgs",
"(",
")",
",",
"'",
"'",
")",
";",
"if",
"(",
"ar",
"!=",
"null",
")",
"{",
"for",
"(",
"String",
"s",
":",
"ar",
")",
"{",
"String",
"[",
"]",
"kv",
"=",
"StringUtils",
".",
"split",
"(",
"s",
",",
"\":\"",
",",
"2",
")",
";",
"if",
"(",
"kv",
"!=",
"null",
"&&",
"kv",
".",
"length",
"==",
"2",
")",
"{",
"ret",
".",
"put",
"(",
"StringUtils",
".",
"trim",
"(",
"kv",
"[",
"0",
"]",
")",
",",
"StringUtils",
".",
"trim",
"(",
"kv",
"[",
"1",
"]",
")",
")",
";",
"}",
"else",
"{",
"//TODO error log?",
"}",
"}",
"}",
"return",
"ret",
";",
"}"
] |
Returns a map of all tokens that can be considered being command arguments, using the current token position.
@return argument map, using ':' as key/value separator (and naturally white spaces as separator between pairs)
|
[
"Returns",
"a",
"map",
"of",
"all",
"tokens",
"that",
"can",
"be",
"considered",
"being",
"command",
"arguments",
"using",
"the",
"current",
"token",
"position",
"."
] |
6d845bcc482aa9344d016e80c0c3455aeae13a13
|
https://github.com/vdmeer/skb-java-base/blob/6d845bcc482aa9344d016e80c0c3455aeae13a13/src/main/java/de/vandermeer/skb/base/shell/LineParser.java#L113-L128
|
150,670
|
GerdHolz/TOVAL
|
src/de/invation/code/toval/os/WindowsRegistry.java
|
WindowsRegistry.createKey
|
public static void createKey(String keyName) throws RegistryException {
int[] info = invoke(Methods.REG_CREATE_KEY_EX.get(), keyParts(keyName));
checkError(info[InfoIndex.INFO_ERROR_CODE.get()]);
invoke(Methods.REG_CLOSE_KEY.get(), info[InfoIndex.INFO_HANDLE.get()]);
}
|
java
|
public static void createKey(String keyName) throws RegistryException {
int[] info = invoke(Methods.REG_CREATE_KEY_EX.get(), keyParts(keyName));
checkError(info[InfoIndex.INFO_ERROR_CODE.get()]);
invoke(Methods.REG_CLOSE_KEY.get(), info[InfoIndex.INFO_HANDLE.get()]);
}
|
[
"public",
"static",
"void",
"createKey",
"(",
"String",
"keyName",
")",
"throws",
"RegistryException",
"{",
"int",
"[",
"]",
"info",
"=",
"invoke",
"(",
"Methods",
".",
"REG_CREATE_KEY_EX",
".",
"get",
"(",
")",
",",
"keyParts",
"(",
"keyName",
")",
")",
";",
"checkError",
"(",
"info",
"[",
"InfoIndex",
".",
"INFO_ERROR_CODE",
".",
"get",
"(",
")",
"]",
")",
";",
"invoke",
"(",
"Methods",
".",
"REG_CLOSE_KEY",
".",
"get",
"(",
")",
",",
"info",
"[",
"InfoIndex",
".",
"INFO_HANDLE",
".",
"get",
"(",
")",
"]",
")",
";",
"}"
] |
Creates a key. Parent keys in the path will also be created if necessary.
This method returns without error if the key already exists.
@param keyName Key name (i.a. with parent keys) to be created.
@throws RegistryException
|
[
"Creates",
"a",
"key",
".",
"Parent",
"keys",
"in",
"the",
"path",
"will",
"also",
"be",
"created",
"if",
"necessary",
".",
"This",
"method",
"returns",
"without",
"error",
"if",
"the",
"key",
"already",
"exists",
"."
] |
036922cdfd710fa53b18e5dbe1e07f226f731fde
|
https://github.com/GerdHolz/TOVAL/blob/036922cdfd710fa53b18e5dbe1e07f226f731fde/src/de/invation/code/toval/os/WindowsRegistry.java#L102-L106
|
150,671
|
GerdHolz/TOVAL
|
src/de/invation/code/toval/os/WindowsRegistry.java
|
WindowsRegistry.deleteKey
|
public static void deleteKey(String keyName) throws RegistryException {
checkError(invoke(Methods.REG_DELETE_KEY.get(), keyParts(keyName)));
}
|
java
|
public static void deleteKey(String keyName) throws RegistryException {
checkError(invoke(Methods.REG_DELETE_KEY.get(), keyParts(keyName)));
}
|
[
"public",
"static",
"void",
"deleteKey",
"(",
"String",
"keyName",
")",
"throws",
"RegistryException",
"{",
"checkError",
"(",
"invoke",
"(",
"Methods",
".",
"REG_DELETE_KEY",
".",
"get",
"(",
")",
",",
"keyParts",
"(",
"keyName",
")",
")",
")",
";",
"}"
] |
Deletes a key and all values within it. If the key has subkeys, an
"Access denied" error will be thrown. Subkeys must be deleted separately.
@param keyName Key name to delete.
@throws RegistryException
|
[
"Deletes",
"a",
"key",
"and",
"all",
"values",
"within",
"it",
".",
"If",
"the",
"key",
"has",
"subkeys",
"an",
"Access",
"denied",
"error",
"will",
"be",
"thrown",
".",
"Subkeys",
"must",
"be",
"deleted",
"separately",
"."
] |
036922cdfd710fa53b18e5dbe1e07f226f731fde
|
https://github.com/GerdHolz/TOVAL/blob/036922cdfd710fa53b18e5dbe1e07f226f731fde/src/de/invation/code/toval/os/WindowsRegistry.java#L115-L117
|
150,672
|
GerdHolz/TOVAL
|
src/de/invation/code/toval/os/WindowsRegistry.java
|
WindowsRegistry.deleteValue
|
public static void deleteValue(String keyName, String valueName) throws RegistryException {
try (Key key = Key.open(keyName, KEY_WRITE)) {
checkError(invoke(Methods.REG_DELETE_VALUE.get(), key.id, toByteArray(valueName)));
}
}
|
java
|
public static void deleteValue(String keyName, String valueName) throws RegistryException {
try (Key key = Key.open(keyName, KEY_WRITE)) {
checkError(invoke(Methods.REG_DELETE_VALUE.get(), key.id, toByteArray(valueName)));
}
}
|
[
"public",
"static",
"void",
"deleteValue",
"(",
"String",
"keyName",
",",
"String",
"valueName",
")",
"throws",
"RegistryException",
"{",
"try",
"(",
"Key",
"key",
"=",
"Key",
".",
"open",
"(",
"keyName",
",",
"KEY_WRITE",
")",
")",
"{",
"checkError",
"(",
"invoke",
"(",
"Methods",
".",
"REG_DELETE_VALUE",
".",
"get",
"(",
")",
",",
"key",
".",
"id",
",",
"toByteArray",
"(",
"valueName",
")",
")",
")",
";",
"}",
"}"
] |
Deletes a value within a key.
@param keyName Name of the key, which contains the value to delete.
@param valueName Name of the value to delete.
@throws RegistryException
|
[
"Deletes",
"a",
"value",
"within",
"a",
"key",
"."
] |
036922cdfd710fa53b18e5dbe1e07f226f731fde
|
https://github.com/GerdHolz/TOVAL/blob/036922cdfd710fa53b18e5dbe1e07f226f731fde/src/de/invation/code/toval/os/WindowsRegistry.java#L126-L130
|
150,673
|
GerdHolz/TOVAL
|
src/de/invation/code/toval/os/WindowsRegistry.java
|
WindowsRegistry.existsKey
|
public static boolean existsKey(String keyName) throws RegistryException {
String[] keyNameParts = keyName.split(REG_PATH_SEPARATOR_REGEX);
// first part must be valid hive
if (Hive.getHive(keyNameParts[0]) == null) {
return false;
}
for (int i = 1; i < keyNameParts.length; i++) {
// build path
StringBuilder path = new StringBuilder();
for (int j = 0; j < i; j++) {
path.append(keyNameParts[j]);
if (j < i) {
path.append(REG_PATH_SEPARATOR);
}
}
// check if next element in path exists
List<String> subkeys = readSubkeys(path.toString());
if (!subkeys.contains(keyNameParts[i])) {
return false;
}
}
return true;
}
|
java
|
public static boolean existsKey(String keyName) throws RegistryException {
String[] keyNameParts = keyName.split(REG_PATH_SEPARATOR_REGEX);
// first part must be valid hive
if (Hive.getHive(keyNameParts[0]) == null) {
return false;
}
for (int i = 1; i < keyNameParts.length; i++) {
// build path
StringBuilder path = new StringBuilder();
for (int j = 0; j < i; j++) {
path.append(keyNameParts[j]);
if (j < i) {
path.append(REG_PATH_SEPARATOR);
}
}
// check if next element in path exists
List<String> subkeys = readSubkeys(path.toString());
if (!subkeys.contains(keyNameParts[i])) {
return false;
}
}
return true;
}
|
[
"public",
"static",
"boolean",
"existsKey",
"(",
"String",
"keyName",
")",
"throws",
"RegistryException",
"{",
"String",
"[",
"]",
"keyNameParts",
"=",
"keyName",
".",
"split",
"(",
"REG_PATH_SEPARATOR_REGEX",
")",
";",
"// first part must be valid hive",
"if",
"(",
"Hive",
".",
"getHive",
"(",
"keyNameParts",
"[",
"0",
"]",
")",
"==",
"null",
")",
"{",
"return",
"false",
";",
"}",
"for",
"(",
"int",
"i",
"=",
"1",
";",
"i",
"<",
"keyNameParts",
".",
"length",
";",
"i",
"++",
")",
"{",
"// build path",
"StringBuilder",
"path",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"for",
"(",
"int",
"j",
"=",
"0",
";",
"j",
"<",
"i",
";",
"j",
"++",
")",
"{",
"path",
".",
"append",
"(",
"keyNameParts",
"[",
"j",
"]",
")",
";",
"if",
"(",
"j",
"<",
"i",
")",
"{",
"path",
".",
"append",
"(",
"REG_PATH_SEPARATOR",
")",
";",
"}",
"}",
"// check if next element in path exists",
"List",
"<",
"String",
">",
"subkeys",
"=",
"readSubkeys",
"(",
"path",
".",
"toString",
"(",
")",
")",
";",
"if",
"(",
"!",
"subkeys",
".",
"contains",
"(",
"keyNameParts",
"[",
"i",
"]",
")",
")",
"{",
"return",
"false",
";",
"}",
"}",
"return",
"true",
";",
"}"
] |
Checks if a given key exists.
@param keyName Key name to check for existence.
@return <code>true</code> if the key exists, otherwise
<code>false</code>.
@throws RegistryException
|
[
"Checks",
"if",
"a",
"given",
"key",
"exists",
"."
] |
036922cdfd710fa53b18e5dbe1e07f226f731fde
|
https://github.com/GerdHolz/TOVAL/blob/036922cdfd710fa53b18e5dbe1e07f226f731fde/src/de/invation/code/toval/os/WindowsRegistry.java#L140-L165
|
150,674
|
GerdHolz/TOVAL
|
src/de/invation/code/toval/os/WindowsRegistry.java
|
WindowsRegistry.readSubkeys
|
public static List<String> readSubkeys(String keyName) throws RegistryException {
try (Key key = Key.open(keyName, KEY_READ)) {
int[] info = invoke(Methods.REG_QUERY_INFO_KEY.get(), key.id);
checkError(info[InfoIndex.INFO_ERROR_CODE.get()]);
int count = info[InfoIndex.INFO_COUNT_KEYS.get()];
int maxLength = info[InfoIndex.INFO_MAX_KEY_LENGTH.get()] + 1;
List<String> subkeys = new ArrayList<>(count);
for (int i = 0; i < count; i++) {
subkeys.add(fromByteArray(invoke(Methods.REG_ENUM_KEY_EX.get(), key.id, i, maxLength)));
}
return subkeys;
}
}
|
java
|
public static List<String> readSubkeys(String keyName) throws RegistryException {
try (Key key = Key.open(keyName, KEY_READ)) {
int[] info = invoke(Methods.REG_QUERY_INFO_KEY.get(), key.id);
checkError(info[InfoIndex.INFO_ERROR_CODE.get()]);
int count = info[InfoIndex.INFO_COUNT_KEYS.get()];
int maxLength = info[InfoIndex.INFO_MAX_KEY_LENGTH.get()] + 1;
List<String> subkeys = new ArrayList<>(count);
for (int i = 0; i < count; i++) {
subkeys.add(fromByteArray(invoke(Methods.REG_ENUM_KEY_EX.get(), key.id, i, maxLength)));
}
return subkeys;
}
}
|
[
"public",
"static",
"List",
"<",
"String",
">",
"readSubkeys",
"(",
"String",
"keyName",
")",
"throws",
"RegistryException",
"{",
"try",
"(",
"Key",
"key",
"=",
"Key",
".",
"open",
"(",
"keyName",
",",
"KEY_READ",
")",
")",
"{",
"int",
"[",
"]",
"info",
"=",
"invoke",
"(",
"Methods",
".",
"REG_QUERY_INFO_KEY",
".",
"get",
"(",
")",
",",
"key",
".",
"id",
")",
";",
"checkError",
"(",
"info",
"[",
"InfoIndex",
".",
"INFO_ERROR_CODE",
".",
"get",
"(",
")",
"]",
")",
";",
"int",
"count",
"=",
"info",
"[",
"InfoIndex",
".",
"INFO_COUNT_KEYS",
".",
"get",
"(",
")",
"]",
";",
"int",
"maxLength",
"=",
"info",
"[",
"InfoIndex",
".",
"INFO_MAX_KEY_LENGTH",
".",
"get",
"(",
")",
"]",
"+",
"1",
";",
"List",
"<",
"String",
">",
"subkeys",
"=",
"new",
"ArrayList",
"<>",
"(",
"count",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"count",
";",
"i",
"++",
")",
"{",
"subkeys",
".",
"add",
"(",
"fromByteArray",
"(",
"invoke",
"(",
"Methods",
".",
"REG_ENUM_KEY_EX",
".",
"get",
"(",
")",
",",
"key",
".",
"id",
",",
"i",
",",
"maxLength",
")",
")",
")",
";",
"}",
"return",
"subkeys",
";",
"}",
"}"
] |
Returns a list of the names of all the subkeys of a key.
@param keyName Key name to read all subkeys from.
@return {@link List} of key names directly contained in the specified
key.
@throws RegistryException
|
[
"Returns",
"a",
"list",
"of",
"the",
"names",
"of",
"all",
"the",
"subkeys",
"of",
"a",
"key",
"."
] |
036922cdfd710fa53b18e5dbe1e07f226f731fde
|
https://github.com/GerdHolz/TOVAL/blob/036922cdfd710fa53b18e5dbe1e07f226f731fde/src/de/invation/code/toval/os/WindowsRegistry.java#L227-L239
|
150,675
|
GerdHolz/TOVAL
|
src/de/invation/code/toval/os/WindowsRegistry.java
|
WindowsRegistry.readValue
|
public static String readValue(String keyName, String valueName) throws RegistryException {
try (Key key = Key.open(keyName, KEY_READ)) {
return fromByteArray(invoke(Methods.REG_QUERY_VALUE_EX.get(), key.id, toByteArray(valueName)));
}
}
|
java
|
public static String readValue(String keyName, String valueName) throws RegistryException {
try (Key key = Key.open(keyName, KEY_READ)) {
return fromByteArray(invoke(Methods.REG_QUERY_VALUE_EX.get(), key.id, toByteArray(valueName)));
}
}
|
[
"public",
"static",
"String",
"readValue",
"(",
"String",
"keyName",
",",
"String",
"valueName",
")",
"throws",
"RegistryException",
"{",
"try",
"(",
"Key",
"key",
"=",
"Key",
".",
"open",
"(",
"keyName",
",",
"KEY_READ",
")",
")",
"{",
"return",
"fromByteArray",
"(",
"invoke",
"(",
"Methods",
".",
"REG_QUERY_VALUE_EX",
".",
"get",
"(",
")",
",",
"key",
".",
"id",
",",
"toByteArray",
"(",
"valueName",
")",
")",
")",
";",
"}",
"}"
] |
Reads a string value from the given key and value name.
@param keyName Name of the key, which contains the value to read.
@param valueName Name of the value to read.
@return Content of the specified value.
@throws RegistryException
|
[
"Reads",
"a",
"string",
"value",
"from",
"the",
"given",
"key",
"and",
"value",
"name",
"."
] |
036922cdfd710fa53b18e5dbe1e07f226f731fde
|
https://github.com/GerdHolz/TOVAL/blob/036922cdfd710fa53b18e5dbe1e07f226f731fde/src/de/invation/code/toval/os/WindowsRegistry.java#L249-L253
|
150,676
|
GerdHolz/TOVAL
|
src/de/invation/code/toval/os/WindowsRegistry.java
|
WindowsRegistry.readValues
|
public static Map<String, String> readValues(String keyName) throws RegistryException {
try (Key key = Key.open(keyName, KEY_READ)) {
int[] info = invoke(Methods.REG_QUERY_INFO_KEY.get(), key.id);
checkError(info[InfoIndex.INFO_ERROR_CODE.get()]);
int count = info[InfoIndex.INFO_COUNT_VALUES.get()];
int maxLength = info[InfoIndex.INFO_MAX_VALUE_LENGTH.get()] + 1;
Map<String, String> values = new HashMap<>();
for (int i = 0; i < count; i++) {
String valueName = fromByteArray(invoke(Methods.REG_ENUM_VALUE.get(), key.id, i, maxLength));
values.put(valueName, readValue(keyName, valueName));
}
return values;
}
}
|
java
|
public static Map<String, String> readValues(String keyName) throws RegistryException {
try (Key key = Key.open(keyName, KEY_READ)) {
int[] info = invoke(Methods.REG_QUERY_INFO_KEY.get(), key.id);
checkError(info[InfoIndex.INFO_ERROR_CODE.get()]);
int count = info[InfoIndex.INFO_COUNT_VALUES.get()];
int maxLength = info[InfoIndex.INFO_MAX_VALUE_LENGTH.get()] + 1;
Map<String, String> values = new HashMap<>();
for (int i = 0; i < count; i++) {
String valueName = fromByteArray(invoke(Methods.REG_ENUM_VALUE.get(), key.id, i, maxLength));
values.put(valueName, readValue(keyName, valueName));
}
return values;
}
}
|
[
"public",
"static",
"Map",
"<",
"String",
",",
"String",
">",
"readValues",
"(",
"String",
"keyName",
")",
"throws",
"RegistryException",
"{",
"try",
"(",
"Key",
"key",
"=",
"Key",
".",
"open",
"(",
"keyName",
",",
"KEY_READ",
")",
")",
"{",
"int",
"[",
"]",
"info",
"=",
"invoke",
"(",
"Methods",
".",
"REG_QUERY_INFO_KEY",
".",
"get",
"(",
")",
",",
"key",
".",
"id",
")",
";",
"checkError",
"(",
"info",
"[",
"InfoIndex",
".",
"INFO_ERROR_CODE",
".",
"get",
"(",
")",
"]",
")",
";",
"int",
"count",
"=",
"info",
"[",
"InfoIndex",
".",
"INFO_COUNT_VALUES",
".",
"get",
"(",
")",
"]",
";",
"int",
"maxLength",
"=",
"info",
"[",
"InfoIndex",
".",
"INFO_MAX_VALUE_LENGTH",
".",
"get",
"(",
")",
"]",
"+",
"1",
";",
"Map",
"<",
"String",
",",
"String",
">",
"values",
"=",
"new",
"HashMap",
"<>",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"count",
";",
"i",
"++",
")",
"{",
"String",
"valueName",
"=",
"fromByteArray",
"(",
"invoke",
"(",
"Methods",
".",
"REG_ENUM_VALUE",
".",
"get",
"(",
")",
",",
"key",
".",
"id",
",",
"i",
",",
"maxLength",
")",
")",
";",
"values",
".",
"put",
"(",
"valueName",
",",
"readValue",
"(",
"keyName",
",",
"valueName",
")",
")",
";",
"}",
"return",
"values",
";",
"}",
"}"
] |
Returns a map of all the name-value pairs in the given key.
@param keyName Name of the key to read all values from.
@return {@link Map} of value name and value content pairs.
@throws RegistryException
|
[
"Returns",
"a",
"map",
"of",
"all",
"the",
"name",
"-",
"value",
"pairs",
"in",
"the",
"given",
"key",
"."
] |
036922cdfd710fa53b18e5dbe1e07f226f731fde
|
https://github.com/GerdHolz/TOVAL/blob/036922cdfd710fa53b18e5dbe1e07f226f731fde/src/de/invation/code/toval/os/WindowsRegistry.java#L262-L275
|
150,677
|
GerdHolz/TOVAL
|
src/de/invation/code/toval/os/WindowsRegistry.java
|
WindowsRegistry.writeValue
|
public static void writeValue(String keyName, String valueName, String value) throws RegistryException {
try (Key key = Key.open(keyName, KEY_WRITE)) {
checkError(invoke(Methods.REG_SET_VALUE_EX.get(), key.id, toByteArray(valueName), toByteArray(value)));
}
}
|
java
|
public static void writeValue(String keyName, String valueName, String value) throws RegistryException {
try (Key key = Key.open(keyName, KEY_WRITE)) {
checkError(invoke(Methods.REG_SET_VALUE_EX.get(), key.id, toByteArray(valueName), toByteArray(value)));
}
}
|
[
"public",
"static",
"void",
"writeValue",
"(",
"String",
"keyName",
",",
"String",
"valueName",
",",
"String",
"value",
")",
"throws",
"RegistryException",
"{",
"try",
"(",
"Key",
"key",
"=",
"Key",
".",
"open",
"(",
"keyName",
",",
"KEY_WRITE",
")",
")",
"{",
"checkError",
"(",
"invoke",
"(",
"Methods",
".",
"REG_SET_VALUE_EX",
".",
"get",
"(",
")",
",",
"key",
".",
"id",
",",
"toByteArray",
"(",
"valueName",
")",
",",
"toByteArray",
"(",
"value",
")",
")",
")",
";",
"}",
"}"
] |
Writes a string value with a given key and value name.
@param keyName Name of the key to write the value in.
@param valueName Name of the value.
@param value Content of the value.
@throws RegistryException
|
[
"Writes",
"a",
"string",
"value",
"with",
"a",
"given",
"key",
"and",
"value",
"name",
"."
] |
036922cdfd710fa53b18e5dbe1e07f226f731fde
|
https://github.com/GerdHolz/TOVAL/blob/036922cdfd710fa53b18e5dbe1e07f226f731fde/src/de/invation/code/toval/os/WindowsRegistry.java#L299-L303
|
150,678
|
ClouDesire/tisana4j
|
src/main/java/com/cloudesire/tisana4j/RestClient.java
|
RestClient.execute
|
private HttpResponse execute( HttpUriRequest request ) throws RestException
{
log.debug( ">>>> " + request.getRequestLine() );
for ( Header header : request.getAllHeaders() )
{
log.trace( ">>>> " + header.getName() + ": " + header.getValue() );
}
HttpResponse response;
try
{
response = getHttpClient().execute( request );
log.debug( "<<<< " + response.getStatusLine() );
for ( Header header : response.getAllHeaders() )
{
log.trace( "<<<< " + header.getName() + ": " + header.getValue() );
}
if ( response.getStatusLine().getStatusCode() == 204 )
{
log.debug( "Consuming quietly the response entity since server returned no content" );
EntityUtils.consumeQuietly( response.getEntity() );
}
checkError( response );
return response;
}
catch ( KeyManagementException | NoSuchAlgorithmException | IOException e )
{
throw new RuntimeRestException( e );
}
finally
{
// https://issues.apache.org/jira/browse/HTTPCLIENT-1523
DateUtils.clearThreadLocal();
}
}
|
java
|
private HttpResponse execute( HttpUriRequest request ) throws RestException
{
log.debug( ">>>> " + request.getRequestLine() );
for ( Header header : request.getAllHeaders() )
{
log.trace( ">>>> " + header.getName() + ": " + header.getValue() );
}
HttpResponse response;
try
{
response = getHttpClient().execute( request );
log.debug( "<<<< " + response.getStatusLine() );
for ( Header header : response.getAllHeaders() )
{
log.trace( "<<<< " + header.getName() + ": " + header.getValue() );
}
if ( response.getStatusLine().getStatusCode() == 204 )
{
log.debug( "Consuming quietly the response entity since server returned no content" );
EntityUtils.consumeQuietly( response.getEntity() );
}
checkError( response );
return response;
}
catch ( KeyManagementException | NoSuchAlgorithmException | IOException e )
{
throw new RuntimeRestException( e );
}
finally
{
// https://issues.apache.org/jira/browse/HTTPCLIENT-1523
DateUtils.clearThreadLocal();
}
}
|
[
"private",
"HttpResponse",
"execute",
"(",
"HttpUriRequest",
"request",
")",
"throws",
"RestException",
"{",
"log",
".",
"debug",
"(",
"\">>>> \"",
"+",
"request",
".",
"getRequestLine",
"(",
")",
")",
";",
"for",
"(",
"Header",
"header",
":",
"request",
".",
"getAllHeaders",
"(",
")",
")",
"{",
"log",
".",
"trace",
"(",
"\">>>> \"",
"+",
"header",
".",
"getName",
"(",
")",
"+",
"\": \"",
"+",
"header",
".",
"getValue",
"(",
")",
")",
";",
"}",
"HttpResponse",
"response",
";",
"try",
"{",
"response",
"=",
"getHttpClient",
"(",
")",
".",
"execute",
"(",
"request",
")",
";",
"log",
".",
"debug",
"(",
"\"<<<< \"",
"+",
"response",
".",
"getStatusLine",
"(",
")",
")",
";",
"for",
"(",
"Header",
"header",
":",
"response",
".",
"getAllHeaders",
"(",
")",
")",
"{",
"log",
".",
"trace",
"(",
"\"<<<< \"",
"+",
"header",
".",
"getName",
"(",
")",
"+",
"\": \"",
"+",
"header",
".",
"getValue",
"(",
")",
")",
";",
"}",
"if",
"(",
"response",
".",
"getStatusLine",
"(",
")",
".",
"getStatusCode",
"(",
")",
"==",
"204",
")",
"{",
"log",
".",
"debug",
"(",
"\"Consuming quietly the response entity since server returned no content\"",
")",
";",
"EntityUtils",
".",
"consumeQuietly",
"(",
"response",
".",
"getEntity",
"(",
")",
")",
";",
"}",
"checkError",
"(",
"response",
")",
";",
"return",
"response",
";",
"}",
"catch",
"(",
"KeyManagementException",
"|",
"NoSuchAlgorithmException",
"|",
"IOException",
"e",
")",
"{",
"throw",
"new",
"RuntimeRestException",
"(",
"e",
")",
";",
"}",
"finally",
"{",
"// https://issues.apache.org/jira/browse/HTTPCLIENT-1523",
"DateUtils",
".",
"clearThreadLocal",
"(",
")",
";",
"}",
"}"
] |
Internal execute, log headers, check for errors
@param request The request object to be executed
@return HttpResponse Response replied by the server
@throws RestException
|
[
"Internal",
"execute",
"log",
"headers",
"check",
"for",
"errors"
] |
6cdee82d15b0f4451e44e4f7b79cfa4eebbbc944
|
https://github.com/ClouDesire/tisana4j/blob/6cdee82d15b0f4451e44e4f7b79cfa4eebbbc944/src/main/java/com/cloudesire/tisana4j/RestClient.java#L737-L773
|
150,679
|
jtrfp/javamod
|
src/main/java/de/quippy/javamod/multimedia/mp3/streaming/IcyInputStream.java
|
IcyInputStream.readInitialHeaders
|
protected void readInitialHeaders() throws IOException
{
String line;
while ((line = readCRLFLine()).length()!=0)
{
int colonIndex = line.indexOf(':');
// does it have a ':' separator
if (colonIndex == -1) continue;
String tagName = line.substring(0, colonIndex);
String value = line.substring(colonIndex + 1);
if (value.toLowerCase().endsWith("<br>")) value = value.substring(0, value.length()-4);
IcyTag tag = new IcyTag(tagName, value);
addTag(tag);
}
}
|
java
|
protected void readInitialHeaders() throws IOException
{
String line;
while ((line = readCRLFLine()).length()!=0)
{
int colonIndex = line.indexOf(':');
// does it have a ':' separator
if (colonIndex == -1) continue;
String tagName = line.substring(0, colonIndex);
String value = line.substring(colonIndex + 1);
if (value.toLowerCase().endsWith("<br>")) value = value.substring(0, value.length()-4);
IcyTag tag = new IcyTag(tagName, value);
addTag(tag);
}
}
|
[
"protected",
"void",
"readInitialHeaders",
"(",
")",
"throws",
"IOException",
"{",
"String",
"line",
";",
"while",
"(",
"(",
"line",
"=",
"readCRLFLine",
"(",
")",
")",
".",
"length",
"(",
")",
"!=",
"0",
")",
"{",
"int",
"colonIndex",
"=",
"line",
".",
"indexOf",
"(",
"'",
"'",
")",
";",
"// does it have a ':' separator",
"if",
"(",
"colonIndex",
"==",
"-",
"1",
")",
"continue",
";",
"String",
"tagName",
"=",
"line",
".",
"substring",
"(",
"0",
",",
"colonIndex",
")",
";",
"String",
"value",
"=",
"line",
".",
"substring",
"(",
"colonIndex",
"+",
"1",
")",
";",
"if",
"(",
"value",
".",
"toLowerCase",
"(",
")",
".",
"endsWith",
"(",
"\"<br>\"",
")",
")",
"value",
"=",
"value",
".",
"substring",
"(",
"0",
",",
"value",
".",
"length",
"(",
")",
"-",
"4",
")",
";",
"IcyTag",
"tag",
"=",
"new",
"IcyTag",
"(",
"tagName",
",",
"value",
")",
";",
"addTag",
"(",
"tag",
")",
";",
"}",
"}"
] |
Assuming we're at the top of the stream, read lines one
by one until we hit a completely blank \r\n. Parse the
data as IcyTags.
|
[
"Assuming",
"we",
"re",
"at",
"the",
"top",
"of",
"the",
"stream",
"read",
"lines",
"one",
"by",
"one",
"until",
"we",
"hit",
"a",
"completely",
"blank",
"\\",
"r",
"\\",
"n",
".",
"Parse",
"the",
"data",
"as",
"IcyTags",
"."
] |
cda4fe943a589dc49415f4413453e2eece72076a
|
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/javamod/multimedia/mp3/streaming/IcyInputStream.java#L183-L197
|
150,680
|
jtrfp/javamod
|
src/main/java/de/quippy/javamod/multimedia/mp3/streaming/IcyInputStream.java
|
IcyInputStream.readCRLFLine
|
protected String readCRLFLine() throws IOException
{
int i = 0;
while (i<1024)
{
byte aByte = (byte) read();
if (aByte=='\n') break;
if (aByte=='\r') continue;
crlfBuffer[i++] = aByte;
}
return charsetDecoder.decode(ByteBuffer.wrap(crlfBuffer, 0, i)).toString();
}
|
java
|
protected String readCRLFLine() throws IOException
{
int i = 0;
while (i<1024)
{
byte aByte = (byte) read();
if (aByte=='\n') break;
if (aByte=='\r') continue;
crlfBuffer[i++] = aByte;
}
return charsetDecoder.decode(ByteBuffer.wrap(crlfBuffer, 0, i)).toString();
}
|
[
"protected",
"String",
"readCRLFLine",
"(",
")",
"throws",
"IOException",
"{",
"int",
"i",
"=",
"0",
";",
"while",
"(",
"i",
"<",
"1024",
")",
"{",
"byte",
"aByte",
"=",
"(",
"byte",
")",
"read",
"(",
")",
";",
"if",
"(",
"aByte",
"==",
"'",
"'",
")",
"break",
";",
"if",
"(",
"aByte",
"==",
"'",
"'",
")",
"continue",
";",
"crlfBuffer",
"[",
"i",
"++",
"]",
"=",
"aByte",
";",
"}",
"return",
"charsetDecoder",
".",
"decode",
"(",
"ByteBuffer",
".",
"wrap",
"(",
"crlfBuffer",
",",
"0",
",",
"i",
")",
")",
".",
"toString",
"(",
")",
";",
"}"
] |
Read everything up to the next CRLF, return it as
a String.
|
[
"Read",
"everything",
"up",
"to",
"the",
"next",
"CRLF",
"return",
"it",
"as",
"a",
"String",
"."
] |
cda4fe943a589dc49415f4413453e2eece72076a
|
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/javamod/multimedia/mp3/streaming/IcyInputStream.java#L202-L213
|
150,681
|
jtrfp/javamod
|
src/main/java/de/quippy/javamod/multimedia/mp3/streaming/IcyInputStream.java
|
IcyInputStream.read
|
public synchronized int read() throws IOException
{
if (bytesUntilNextMetadata > 0)
{
bytesUntilNextMetadata--;
return super.read();
}
else
if (bytesUntilNextMetadata == 0)
{
readMetadata();
bytesUntilNextMetadata = metaint - 1;
// -1 because we read byte on next line
return super.read();
}
else
{
return super.read();
}
}
|
java
|
public synchronized int read() throws IOException
{
if (bytesUntilNextMetadata > 0)
{
bytesUntilNextMetadata--;
return super.read();
}
else
if (bytesUntilNextMetadata == 0)
{
readMetadata();
bytesUntilNextMetadata = metaint - 1;
// -1 because we read byte on next line
return super.read();
}
else
{
return super.read();
}
}
|
[
"public",
"synchronized",
"int",
"read",
"(",
")",
"throws",
"IOException",
"{",
"if",
"(",
"bytesUntilNextMetadata",
">",
"0",
")",
"{",
"bytesUntilNextMetadata",
"--",
";",
"return",
"super",
".",
"read",
"(",
")",
";",
"}",
"else",
"if",
"(",
"bytesUntilNextMetadata",
"==",
"0",
")",
"{",
"readMetadata",
"(",
")",
";",
"bytesUntilNextMetadata",
"=",
"metaint",
"-",
"1",
";",
"// -1 because we read byte on next line",
"return",
"super",
".",
"read",
"(",
")",
";",
"}",
"else",
"{",
"return",
"super",
".",
"read",
"(",
")",
";",
"}",
"}"
] |
Reads and returns a single byte.
If the next byte is a metadata block, then that
block is read, stripped, and parsed before reading
and returning the first byte after the metadata block.
|
[
"Reads",
"and",
"returns",
"a",
"single",
"byte",
".",
"If",
"the",
"next",
"byte",
"is",
"a",
"metadata",
"block",
"then",
"that",
"block",
"is",
"read",
"stripped",
"and",
"parsed",
"before",
"reading",
"and",
"returning",
"the",
"first",
"byte",
"after",
"the",
"metadata",
"block",
"."
] |
cda4fe943a589dc49415f4413453e2eece72076a
|
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/javamod/multimedia/mp3/streaming/IcyInputStream.java#L220-L239
|
150,682
|
jtrfp/javamod
|
src/main/java/de/quippy/javamod/multimedia/mp3/streaming/IcyInputStream.java
|
IcyInputStream.addTag
|
protected void addTag(IcyTag tag)
{
tags.put(tag.getName(), tag);
fireTagParsed(this, tag);
}
|
java
|
protected void addTag(IcyTag tag)
{
tags.put(tag.getName(), tag);
fireTagParsed(this, tag);
}
|
[
"protected",
"void",
"addTag",
"(",
"IcyTag",
"tag",
")",
"{",
"tags",
".",
"put",
"(",
"tag",
".",
"getName",
"(",
")",
",",
"tag",
")",
";",
"fireTagParsed",
"(",
"this",
",",
"tag",
")",
";",
"}"
] |
adds the tag to the HashMap of tags we have encountered
either in-stream or as headers, replacing any previous
tag with this name.
|
[
"adds",
"the",
"tag",
"to",
"the",
"HashMap",
"of",
"tags",
"we",
"have",
"encountered",
"either",
"in",
"-",
"stream",
"or",
"as",
"headers",
"replacing",
"any",
"previous",
"tag",
"with",
"this",
"name",
"."
] |
cda4fe943a589dc49415f4413453e2eece72076a
|
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/javamod/multimedia/mp3/streaming/IcyInputStream.java#L355-L359
|
150,683
|
jtrfp/javamod
|
src/main/java/de/quippy/javamod/multimedia/mp3/streaming/IcyInputStream.java
|
IcyInputStream.fireTagParseEvent
|
public void fireTagParseEvent(TagParseEvent tpe)
{
for (int i = 0; i < tagParseListeners.size(); i++)
{
TagParseListener l = tagParseListeners.get(i);
l.tagParsed(tpe);
}
}
|
java
|
public void fireTagParseEvent(TagParseEvent tpe)
{
for (int i = 0; i < tagParseListeners.size(); i++)
{
TagParseListener l = tagParseListeners.get(i);
l.tagParsed(tpe);
}
}
|
[
"public",
"void",
"fireTagParseEvent",
"(",
"TagParseEvent",
"tpe",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"tagParseListeners",
".",
"size",
"(",
")",
";",
"i",
"++",
")",
"{",
"TagParseListener",
"l",
"=",
"tagParseListeners",
".",
"get",
"(",
"i",
")",
";",
"l",
".",
"tagParsed",
"(",
"tpe",
")",
";",
"}",
"}"
] |
Fires the given event to all registered listeners
|
[
"Fires",
"the",
"given",
"event",
"to",
"all",
"registered",
"listeners"
] |
cda4fe943a589dc49415f4413453e2eece72076a
|
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/javamod/multimedia/mp3/streaming/IcyInputStream.java#L399-L406
|
150,684
|
jpaoletti/java-presentation-manager
|
modules/jpm-struts1/src/main/java/jpaoletti/jpm/struts/PMStrutsContext.java
|
PMStrutsContext.getEntitySupport
|
public PMEntitySupport getEntitySupport() {
PMEntitySupport r = (PMEntitySupport) getRequest().getSession().getAttribute(ENTITY_SUPPORT);
return r;
}
|
java
|
public PMEntitySupport getEntitySupport() {
PMEntitySupport r = (PMEntitySupport) getRequest().getSession().getAttribute(ENTITY_SUPPORT);
return r;
}
|
[
"public",
"PMEntitySupport",
"getEntitySupport",
"(",
")",
"{",
"PMEntitySupport",
"r",
"=",
"(",
"PMEntitySupport",
")",
"getRequest",
"(",
")",
".",
"getSession",
"(",
")",
".",
"getAttribute",
"(",
"ENTITY_SUPPORT",
")",
";",
"return",
"r",
";",
"}"
] |
Getter for the entity support helper object
@return The entity support
|
[
"Getter",
"for",
"the",
"entity",
"support",
"helper",
"object"
] |
d5aab55638383695db244744b4bfe27c5200e04f
|
https://github.com/jpaoletti/java-presentation-manager/blob/d5aab55638383695db244744b4bfe27c5200e04f/modules/jpm-struts1/src/main/java/jpaoletti/jpm/struts/PMStrutsContext.java#L112-L115
|
150,685
|
jtrfp/javamod
|
src/main/java/de/quippy/javamod/mixer/dsp/FFT.java
|
FFT.prepareFFTTables
|
private void prepareFFTTables()
{
int n2 = ss2;
int nu1 = nu-1;
int k = 0;
int x = 0;
for (int l=1; l<=nu; l++)
{
while (k < ss)
{
for (int i=1; i<=n2; i++)
{
double p = (double)bitrev(k >> nu1, nu);
double arg = (Math.PI * p * 2.0D) / (double) ss;
fftSin[x] = (long) (Math.sin(arg) * FRAC_FAC);
fftCos[x] = (long) (Math.cos(arg) * FRAC_FAC);
k++;
x++;
}
k += n2;
}
k = 0;
nu1--;
n2 >>= 1;
}
for (k=0; k<ss; k++)
fftBr[k] = bitrev(k, nu);
}
|
java
|
private void prepareFFTTables()
{
int n2 = ss2;
int nu1 = nu-1;
int k = 0;
int x = 0;
for (int l=1; l<=nu; l++)
{
while (k < ss)
{
for (int i=1; i<=n2; i++)
{
double p = (double)bitrev(k >> nu1, nu);
double arg = (Math.PI * p * 2.0D) / (double) ss;
fftSin[x] = (long) (Math.sin(arg) * FRAC_FAC);
fftCos[x] = (long) (Math.cos(arg) * FRAC_FAC);
k++;
x++;
}
k += n2;
}
k = 0;
nu1--;
n2 >>= 1;
}
for (k=0; k<ss; k++)
fftBr[k] = bitrev(k, nu);
}
|
[
"private",
"void",
"prepareFFTTables",
"(",
")",
"{",
"int",
"n2",
"=",
"ss2",
";",
"int",
"nu1",
"=",
"nu",
"-",
"1",
";",
"int",
"k",
"=",
"0",
";",
"int",
"x",
"=",
"0",
";",
"for",
"(",
"int",
"l",
"=",
"1",
";",
"l",
"<=",
"nu",
";",
"l",
"++",
")",
"{",
"while",
"(",
"k",
"<",
"ss",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"1",
";",
"i",
"<=",
"n2",
";",
"i",
"++",
")",
"{",
"double",
"p",
"=",
"(",
"double",
")",
"bitrev",
"(",
"k",
">>",
"nu1",
",",
"nu",
")",
";",
"double",
"arg",
"=",
"(",
"Math",
".",
"PI",
"*",
"p",
"*",
"2.0D",
")",
"/",
"(",
"double",
")",
"ss",
";",
"fftSin",
"[",
"x",
"]",
"=",
"(",
"long",
")",
"(",
"Math",
".",
"sin",
"(",
"arg",
")",
"*",
"FRAC_FAC",
")",
";",
"fftCos",
"[",
"x",
"]",
"=",
"(",
"long",
")",
"(",
"Math",
".",
"cos",
"(",
"arg",
")",
"*",
"FRAC_FAC",
")",
";",
"k",
"++",
";",
"x",
"++",
";",
"}",
"k",
"+=",
"n2",
";",
"}",
"k",
"=",
"0",
";",
"nu1",
"--",
";",
"n2",
">>=",
"1",
";",
"}",
"for",
"(",
"k",
"=",
"0",
";",
"k",
"<",
"ss",
";",
"k",
"++",
")",
"fftBr",
"[",
"k",
"]",
"=",
"bitrev",
"(",
"k",
",",
"nu",
")",
";",
"}"
] |
We will here precalculate all sin and cos values
and all other things we can store
@since 03.10.2007
|
[
"We",
"will",
"here",
"precalculate",
"all",
"sin",
"and",
"cos",
"values",
"and",
"all",
"other",
"things",
"we",
"can",
"store"
] |
cda4fe943a589dc49415f4413453e2eece72076a
|
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/javamod/mixer/dsp/FFT.java#L71-L100
|
150,686
|
jtrfp/javamod
|
src/main/java/de/quippy/javamod/mixer/dsp/FFT.java
|
FFT.longSqrt
|
private static long longSqrt(long value)
{
final int scale = 8;
int bits = 64;
long sqrt=0;
long rest=0;
for (int i=0; i<scale; i++)
{
bits -= 8;
rest = (rest<<8) | ((value>>bits)&0xFF);
long i2 = (sqrt<<5)+1;
int k0=0;
while (true)
{
long i3 = rest-i2;
if (i3<0) break;
rest=i3;
i2+=2;
k0++;
}
sqrt=(sqrt<<4)+k0;
}
return sqrt;
}
|
java
|
private static long longSqrt(long value)
{
final int scale = 8;
int bits = 64;
long sqrt=0;
long rest=0;
for (int i=0; i<scale; i++)
{
bits -= 8;
rest = (rest<<8) | ((value>>bits)&0xFF);
long i2 = (sqrt<<5)+1;
int k0=0;
while (true)
{
long i3 = rest-i2;
if (i3<0) break;
rest=i3;
i2+=2;
k0++;
}
sqrt=(sqrt<<4)+k0;
}
return sqrt;
}
|
[
"private",
"static",
"long",
"longSqrt",
"(",
"long",
"value",
")",
"{",
"final",
"int",
"scale",
"=",
"8",
";",
"int",
"bits",
"=",
"64",
";",
"long",
"sqrt",
"=",
"0",
";",
"long",
"rest",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"scale",
";",
"i",
"++",
")",
"{",
"bits",
"-=",
"8",
";",
"rest",
"=",
"(",
"rest",
"<<",
"8",
")",
"|",
"(",
"(",
"value",
">>",
"bits",
")",
"&",
"0xFF",
")",
";",
"long",
"i2",
"=",
"(",
"sqrt",
"<<",
"5",
")",
"+",
"1",
";",
"int",
"k0",
"=",
"0",
";",
"while",
"(",
"true",
")",
"{",
"long",
"i3",
"=",
"rest",
"-",
"i2",
";",
"if",
"(",
"i3",
"<",
"0",
")",
"break",
";",
"rest",
"=",
"i3",
";",
"i2",
"+=",
"2",
";",
"k0",
"++",
";",
"}",
"sqrt",
"=",
"(",
"sqrt",
"<<",
"4",
")",
"+",
"k0",
";",
"}",
"return",
"sqrt",
";",
"}"
] |
This will calculate the integer sqrt from a long value
@since 03.10.2007
@param value
@return
|
[
"This",
"will",
"calculate",
"the",
"integer",
"sqrt",
"from",
"a",
"long",
"value"
] |
cda4fe943a589dc49415f4413453e2eece72076a
|
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/javamod/mixer/dsp/FFT.java#L107-L133
|
150,687
|
vdmeer/skb-java-base
|
src/main/java/de/vandermeer/skb/base/info/STGroupValidator.java
|
STGroupValidator.validate
|
protected void validate(STGroup stg, Map<String, Set<String>> expectedChunks){
for (String s : expectedChunks.keySet()){
//null and "" are no valid templates, so we ignore them
if(s!=null && !"".equals(s)){
if(stg.isDefined(s)){
STValidator stv = new STValidator(stg.getInstanceOf(s), expectedChunks.get(s));
this.errors.addAllErrors(stv.getValidationErrors());
}
else{
this.errors.addError("STGroup <{}> does not define mandatory template <{}>", GET_STG_NAME(stg), s);
}
}
}
}
|
java
|
protected void validate(STGroup stg, Map<String, Set<String>> expectedChunks){
for (String s : expectedChunks.keySet()){
//null and "" are no valid templates, so we ignore them
if(s!=null && !"".equals(s)){
if(stg.isDefined(s)){
STValidator stv = new STValidator(stg.getInstanceOf(s), expectedChunks.get(s));
this.errors.addAllErrors(stv.getValidationErrors());
}
else{
this.errors.addError("STGroup <{}> does not define mandatory template <{}>", GET_STG_NAME(stg), s);
}
}
}
}
|
[
"protected",
"void",
"validate",
"(",
"STGroup",
"stg",
",",
"Map",
"<",
"String",
",",
"Set",
"<",
"String",
">",
">",
"expectedChunks",
")",
"{",
"for",
"(",
"String",
"s",
":",
"expectedChunks",
".",
"keySet",
"(",
")",
")",
"{",
"//null and \"\" are no valid templates, so we ignore them",
"if",
"(",
"s",
"!=",
"null",
"&&",
"!",
"\"\"",
".",
"equals",
"(",
"s",
")",
")",
"{",
"if",
"(",
"stg",
".",
"isDefined",
"(",
"s",
")",
")",
"{",
"STValidator",
"stv",
"=",
"new",
"STValidator",
"(",
"stg",
".",
"getInstanceOf",
"(",
"s",
")",
",",
"expectedChunks",
".",
"get",
"(",
"s",
")",
")",
";",
"this",
".",
"errors",
".",
"addAllErrors",
"(",
"stv",
".",
"getValidationErrors",
"(",
")",
")",
";",
"}",
"else",
"{",
"this",
".",
"errors",
".",
"addError",
"(",
"\"STGroup <{}> does not define mandatory template <{}>\"",
",",
"GET_STG_NAME",
"(",
"stg",
")",
",",
"s",
")",
";",
"}",
"}",
"}",
"}"
] |
Does the actual validation of the STGroup.
@param stg the STGroup to validate
@param expectedChunks the expected chunks (methods and their arguments) to validate against
|
[
"Does",
"the",
"actual",
"validation",
"of",
"the",
"STGroup",
"."
] |
6d845bcc482aa9344d016e80c0c3455aeae13a13
|
https://github.com/vdmeer/skb-java-base/blob/6d845bcc482aa9344d016e80c0c3455aeae13a13/src/main/java/de/vandermeer/skb/base/info/STGroupValidator.java#L69-L82
|
150,688
|
vdmeer/skb-java-base
|
src/main/java/de/vandermeer/skb/base/info/STGroupValidator.java
|
STGroupValidator.GET_STG_NAME
|
public static final String GET_STG_NAME(STGroup stg){
String ret = null;
if(stg instanceof STGroupFile){
ret = ((STGroupFile)stg).fileName;
}
else if(stg instanceof STGroupString){
ret = ((STGroupString)stg).sourceName;
}
else if(stg instanceof STGroupDir){
ret = ((STGroupDir)stg).groupDirName;
}
return StringUtils.substringBeforeLast(ret, ".");
}
|
java
|
public static final String GET_STG_NAME(STGroup stg){
String ret = null;
if(stg instanceof STGroupFile){
ret = ((STGroupFile)stg).fileName;
}
else if(stg instanceof STGroupString){
ret = ((STGroupString)stg).sourceName;
}
else if(stg instanceof STGroupDir){
ret = ((STGroupDir)stg).groupDirName;
}
return StringUtils.substringBeforeLast(ret, ".");
}
|
[
"public",
"static",
"final",
"String",
"GET_STG_NAME",
"(",
"STGroup",
"stg",
")",
"{",
"String",
"ret",
"=",
"null",
";",
"if",
"(",
"stg",
"instanceof",
"STGroupFile",
")",
"{",
"ret",
"=",
"(",
"(",
"STGroupFile",
")",
"stg",
")",
".",
"fileName",
";",
"}",
"else",
"if",
"(",
"stg",
"instanceof",
"STGroupString",
")",
"{",
"ret",
"=",
"(",
"(",
"STGroupString",
")",
"stg",
")",
".",
"sourceName",
";",
"}",
"else",
"if",
"(",
"stg",
"instanceof",
"STGroupDir",
")",
"{",
"ret",
"=",
"(",
"(",
"STGroupDir",
")",
"stg",
")",
".",
"groupDirName",
";",
"}",
"return",
"StringUtils",
".",
"substringBeforeLast",
"(",
"ret",
",",
"\".\"",
")",
";",
"}"
] |
Returns the name of the STGroup.
Any file extension will be removed from the returned name.
@param stg STGroup
@return name of the group or null
|
[
"Returns",
"the",
"name",
"of",
"the",
"STGroup",
".",
"Any",
"file",
"extension",
"will",
"be",
"removed",
"from",
"the",
"returned",
"name",
"."
] |
6d845bcc482aa9344d016e80c0c3455aeae13a13
|
https://github.com/vdmeer/skb-java-base/blob/6d845bcc482aa9344d016e80c0c3455aeae13a13/src/main/java/de/vandermeer/skb/base/info/STGroupValidator.java#L100-L112
|
150,689
|
vdmeer/skb-java-base
|
src/main/java/de/vandermeer/skb/base/managers/MessageMgrBuilder.java
|
MessageMgrBuilder.setHandler
|
public MessageMgrBuilder setHandler(E_MessageType type){
if(type!=null){
this.messageHandlers.put(type, new MessageTypeHandler(type));
}
else{
this.buildErrors.addError("{}: cannot add handler for empty type", this.getClass().getSimpleName());
}
return this;
}
|
java
|
public MessageMgrBuilder setHandler(E_MessageType type){
if(type!=null){
this.messageHandlers.put(type, new MessageTypeHandler(type));
}
else{
this.buildErrors.addError("{}: cannot add handler for empty type", this.getClass().getSimpleName());
}
return this;
}
|
[
"public",
"MessageMgrBuilder",
"setHandler",
"(",
"E_MessageType",
"type",
")",
"{",
"if",
"(",
"type",
"!=",
"null",
")",
"{",
"this",
".",
"messageHandlers",
".",
"put",
"(",
"type",
",",
"new",
"MessageTypeHandler",
"(",
"type",
")",
")",
";",
"}",
"else",
"{",
"this",
".",
"buildErrors",
".",
"addError",
"(",
"\"{}: cannot add handler for empty type\"",
",",
"this",
".",
"getClass",
"(",
")",
".",
"getSimpleName",
"(",
")",
")",
";",
"}",
"return",
"this",
";",
"}"
] |
Activate a message type and sets a type handler with max count set to 100.
An existing handler will be overwritten.
@param type message type to be activated, nothing will be set if null
@return self to allow for chaining
|
[
"Activate",
"a",
"message",
"type",
"and",
"sets",
"a",
"type",
"handler",
"with",
"max",
"count",
"set",
"to",
"100",
".",
"An",
"existing",
"handler",
"will",
"be",
"overwritten",
"."
] |
6d845bcc482aa9344d016e80c0c3455aeae13a13
|
https://github.com/vdmeer/skb-java-base/blob/6d845bcc482aa9344d016e80c0c3455aeae13a13/src/main/java/de/vandermeer/skb/base/managers/MessageMgrBuilder.java#L80-L88
|
150,690
|
mytechia/mytechia_commons
|
mytechia_commons_library/src/main/java/com/mytechia/commons/util/thread/Threads.java
|
Threads.findRootThreadGroup
|
public static ThreadGroup findRootThreadGroup()
{
ThreadGroup root = Thread.currentThread().getThreadGroup();
while (root.getParent() != null) {
root = root.getParent();
}
return root;
}
|
java
|
public static ThreadGroup findRootThreadGroup()
{
ThreadGroup root = Thread.currentThread().getThreadGroup();
while (root.getParent() != null) {
root = root.getParent();
}
return root;
}
|
[
"public",
"static",
"ThreadGroup",
"findRootThreadGroup",
"(",
")",
"{",
"ThreadGroup",
"root",
"=",
"Thread",
".",
"currentThread",
"(",
")",
".",
"getThreadGroup",
"(",
")",
";",
"while",
"(",
"root",
".",
"getParent",
"(",
")",
"!=",
"null",
")",
"{",
"root",
"=",
"root",
".",
"getParent",
"(",
")",
";",
"}",
"return",
"root",
";",
"}"
] |
Find the root thread group.
@return
|
[
"Find",
"the",
"root",
"thread",
"group",
"."
] |
02251879085f271a1fb51663a1c8eddc8be78ae7
|
https://github.com/mytechia/mytechia_commons/blob/02251879085f271a1fb51663a1c8eddc8be78ae7/mytechia_commons_library/src/main/java/com/mytechia/commons/util/thread/Threads.java#L36-L43
|
150,691
|
mytechia/mytechia_commons
|
mytechia_commons_library/src/main/java/com/mytechia/commons/util/thread/Threads.java
|
Threads.findActiveThreadByName
|
private static Thread findActiveThreadByName(ThreadGroup group, String threadName)
{
Thread result = null;
// Get threads in 'group'
int numThreads = group.activeCount();
Thread[] threads = new Thread[numThreads * 2];
numThreads = group.enumerate(threads, false);
// Enumerate each thread in 'group'
for (int i = 0; i < numThreads; i++) {
if (threads[i].getName().equals(threadName)) {
return threads[i];
}
}
// Get thread subgroups of 'group'
int numGroups = group.activeGroupCount();
ThreadGroup[] groups = new ThreadGroup[numGroups * 2];
numGroups = group.enumerate(groups, false);
// Recursively visit each subgroup
for (int i = 0; i < numGroups; i++) {
result = findActiveThreadByName(groups[i], threadName);
if (result != null) {
break;
}
}
return result;
}
|
java
|
private static Thread findActiveThreadByName(ThreadGroup group, String threadName)
{
Thread result = null;
// Get threads in 'group'
int numThreads = group.activeCount();
Thread[] threads = new Thread[numThreads * 2];
numThreads = group.enumerate(threads, false);
// Enumerate each thread in 'group'
for (int i = 0; i < numThreads; i++) {
if (threads[i].getName().equals(threadName)) {
return threads[i];
}
}
// Get thread subgroups of 'group'
int numGroups = group.activeGroupCount();
ThreadGroup[] groups = new ThreadGroup[numGroups * 2];
numGroups = group.enumerate(groups, false);
// Recursively visit each subgroup
for (int i = 0; i < numGroups; i++) {
result = findActiveThreadByName(groups[i], threadName);
if (result != null) {
break;
}
}
return result;
}
|
[
"private",
"static",
"Thread",
"findActiveThreadByName",
"(",
"ThreadGroup",
"group",
",",
"String",
"threadName",
")",
"{",
"Thread",
"result",
"=",
"null",
";",
"// Get threads in 'group'",
"int",
"numThreads",
"=",
"group",
".",
"activeCount",
"(",
")",
";",
"Thread",
"[",
"]",
"threads",
"=",
"new",
"Thread",
"[",
"numThreads",
"*",
"2",
"]",
";",
"numThreads",
"=",
"group",
".",
"enumerate",
"(",
"threads",
",",
"false",
")",
";",
"// Enumerate each thread in 'group'",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"numThreads",
";",
"i",
"++",
")",
"{",
"if",
"(",
"threads",
"[",
"i",
"]",
".",
"getName",
"(",
")",
".",
"equals",
"(",
"threadName",
")",
")",
"{",
"return",
"threads",
"[",
"i",
"]",
";",
"}",
"}",
"// Get thread subgroups of 'group'",
"int",
"numGroups",
"=",
"group",
".",
"activeGroupCount",
"(",
")",
";",
"ThreadGroup",
"[",
"]",
"groups",
"=",
"new",
"ThreadGroup",
"[",
"numGroups",
"*",
"2",
"]",
";",
"numGroups",
"=",
"group",
".",
"enumerate",
"(",
"groups",
",",
"false",
")",
";",
"// Recursively visit each subgroup",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"numGroups",
";",
"i",
"++",
")",
"{",
"result",
"=",
"findActiveThreadByName",
"(",
"groups",
"[",
"i",
"]",
",",
"threadName",
")",
";",
"if",
"(",
"result",
"!=",
"null",
")",
"{",
"break",
";",
"}",
"}",
"return",
"result",
";",
"}"
] |
This method recursively visits all thread groups under 'group',
searching for the active thread with name 'threadName'.
@param group
@param threadName
@return
|
[
"This",
"method",
"recursively",
"visits",
"all",
"thread",
"groups",
"under",
"group",
"searching",
"for",
"the",
"active",
"thread",
"with",
"name",
"threadName",
"."
] |
02251879085f271a1fb51663a1c8eddc8be78ae7
|
https://github.com/mytechia/mytechia_commons/blob/02251879085f271a1fb51663a1c8eddc8be78ae7/mytechia_commons_library/src/main/java/com/mytechia/commons/util/thread/Threads.java#L65-L96
|
150,692
|
livetribe/livetribe-slp
|
core/src/main/java/org/livetribe/slp/spi/msg/ScopeListExtension.java
|
ScopeListExtension.findFirst
|
public static ScopeListExtension findFirst(Collection<? extends Extension> extensions)
{
for (Extension extension : extensions)
{
if (SCOPE_LIST_EXTENSION_ID == extension.getId())
return (ScopeListExtension)extension;
}
return null;
}
|
java
|
public static ScopeListExtension findFirst(Collection<? extends Extension> extensions)
{
for (Extension extension : extensions)
{
if (SCOPE_LIST_EXTENSION_ID == extension.getId())
return (ScopeListExtension)extension;
}
return null;
}
|
[
"public",
"static",
"ScopeListExtension",
"findFirst",
"(",
"Collection",
"<",
"?",
"extends",
"Extension",
">",
"extensions",
")",
"{",
"for",
"(",
"Extension",
"extension",
":",
"extensions",
")",
"{",
"if",
"(",
"SCOPE_LIST_EXTENSION_ID",
"==",
"extension",
".",
"getId",
"(",
")",
")",
"return",
"(",
"ScopeListExtension",
")",
"extension",
";",
"}",
"return",
"null",
";",
"}"
] |
Returns the first ScopeListExtension found in the given collection of extensions,
or null if the extension collection does not contain a ScopeListExtension.
|
[
"Returns",
"the",
"first",
"ScopeListExtension",
"found",
"in",
"the",
"given",
"collection",
"of",
"extensions",
"or",
"null",
"if",
"the",
"extension",
"collection",
"does",
"not",
"contain",
"a",
"ScopeListExtension",
"."
] |
6cc13dbe81feab133fe3dd291ca081cbc6e1f591
|
https://github.com/livetribe/livetribe-slp/blob/6cc13dbe81feab133fe3dd291ca081cbc6e1f591/core/src/main/java/org/livetribe/slp/spi/msg/ScopeListExtension.java#L167-L175
|
150,693
|
livetribe/livetribe-slp
|
core/src/main/java/org/livetribe/slp/spi/msg/ScopeListExtension.java
|
ScopeListExtension.findAll
|
public static List<ScopeListExtension> findAll(Collection<? extends Extension> extensions)
{
List<ScopeListExtension> result = new ArrayList<ScopeListExtension>();
for (Extension extension : extensions)
{
if (SCOPE_LIST_EXTENSION_ID == extension.getId())
result.add((ScopeListExtension)extension);
}
return result;
}
|
java
|
public static List<ScopeListExtension> findAll(Collection<? extends Extension> extensions)
{
List<ScopeListExtension> result = new ArrayList<ScopeListExtension>();
for (Extension extension : extensions)
{
if (SCOPE_LIST_EXTENSION_ID == extension.getId())
result.add((ScopeListExtension)extension);
}
return result;
}
|
[
"public",
"static",
"List",
"<",
"ScopeListExtension",
">",
"findAll",
"(",
"Collection",
"<",
"?",
"extends",
"Extension",
">",
"extensions",
")",
"{",
"List",
"<",
"ScopeListExtension",
">",
"result",
"=",
"new",
"ArrayList",
"<",
"ScopeListExtension",
">",
"(",
")",
";",
"for",
"(",
"Extension",
"extension",
":",
"extensions",
")",
"{",
"if",
"(",
"SCOPE_LIST_EXTENSION_ID",
"==",
"extension",
".",
"getId",
"(",
")",
")",
"result",
".",
"add",
"(",
"(",
"ScopeListExtension",
")",
"extension",
")",
";",
"}",
"return",
"result",
";",
"}"
] |
Returns all ScopeListExtension found in the given collection of extensions,
or an empty list if the extension collection does not contain ScopeListExtensions.
|
[
"Returns",
"all",
"ScopeListExtension",
"found",
"in",
"the",
"given",
"collection",
"of",
"extensions",
"or",
"an",
"empty",
"list",
"if",
"the",
"extension",
"collection",
"does",
"not",
"contain",
"ScopeListExtensions",
"."
] |
6cc13dbe81feab133fe3dd291ca081cbc6e1f591
|
https://github.com/livetribe/livetribe-slp/blob/6cc13dbe81feab133fe3dd291ca081cbc6e1f591/core/src/main/java/org/livetribe/slp/spi/msg/ScopeListExtension.java#L181-L190
|
150,694
|
dbflute-session/mailflute
|
src/main/java/org/dbflute/mail/Postcard.java
|
Postcard.pushUlterior
|
public void pushUlterior(String key, Object value) {
assertArgumentNotNull("key", key);
assertArgumentNotNull("value", value);
if (pushedUlteriorMap == null) {
pushedUlteriorMap = new LinkedHashMap<String, Object>(4);
}
pushedUlteriorMap.put(key, value);
}
|
java
|
public void pushUlterior(String key, Object value) {
assertArgumentNotNull("key", key);
assertArgumentNotNull("value", value);
if (pushedUlteriorMap == null) {
pushedUlteriorMap = new LinkedHashMap<String, Object>(4);
}
pushedUlteriorMap.put(key, value);
}
|
[
"public",
"void",
"pushUlterior",
"(",
"String",
"key",
",",
"Object",
"value",
")",
"{",
"assertArgumentNotNull",
"(",
"\"key\"",
",",
"key",
")",
";",
"assertArgumentNotNull",
"(",
"\"value\"",
",",
"value",
")",
";",
"if",
"(",
"pushedUlteriorMap",
"==",
"null",
")",
"{",
"pushedUlteriorMap",
"=",
"new",
"LinkedHashMap",
"<",
"String",
",",
"Object",
">",
"(",
"4",
")",
";",
"}",
"pushedUlteriorMap",
".",
"put",
"(",
"key",
",",
"value",
")",
";",
"}"
] |
basically unused in mailflute, this is for extension by application
|
[
"basically",
"unused",
"in",
"mailflute",
"this",
"is",
"for",
"extension",
"by",
"application"
] |
e41da4984131b09d55060e247fa4831682bc40a9
|
https://github.com/dbflute-session/mailflute/blob/e41da4984131b09d55060e247fa4831682bc40a9/src/main/java/org/dbflute/mail/Postcard.java#L351-L358
|
150,695
|
lecousin/java-framework-core
|
net.lecousin.core/src/main/java/net/lecousin/framework/concurrent/util/LimitAsyncOperations.java
|
LimitAsyncOperations.write
|
public AsyncWork<OutputResultType, OutputErrorType> write(InputType data) throws IOException {
do {
SynchronizationPoint<NoException> lk;
synchronized (waiting) {
// if cancelled or errored, return immediately
if (error != null) return new AsyncWork<>(null, error);
if (cancelled != null) return new AsyncWork<>(null, null, cancelled);
AsyncWork<OutputResultType, OutputErrorType> op;
// if ready, write immediately
if (isReady) {
isReady = false;
op = lastWrite = executor.execute(data);
lastWrite.listenInline(new WriteListener(data, op, null));
return op;
}
// not ready
if (!waiting.isFull()) {
op = new AsyncWork<>();
waiting.addLast(new Pair<>(data, op));
lastWrite = op;
return op;
}
// full
if (lock != null)
throw new IOException("Concurrent write");
lock = new SynchronizationPoint<>();
lk = lock;
}
lk.block(0);
} while (true);
}
|
java
|
public AsyncWork<OutputResultType, OutputErrorType> write(InputType data) throws IOException {
do {
SynchronizationPoint<NoException> lk;
synchronized (waiting) {
// if cancelled or errored, return immediately
if (error != null) return new AsyncWork<>(null, error);
if (cancelled != null) return new AsyncWork<>(null, null, cancelled);
AsyncWork<OutputResultType, OutputErrorType> op;
// if ready, write immediately
if (isReady) {
isReady = false;
op = lastWrite = executor.execute(data);
lastWrite.listenInline(new WriteListener(data, op, null));
return op;
}
// not ready
if (!waiting.isFull()) {
op = new AsyncWork<>();
waiting.addLast(new Pair<>(data, op));
lastWrite = op;
return op;
}
// full
if (lock != null)
throw new IOException("Concurrent write");
lock = new SynchronizationPoint<>();
lk = lock;
}
lk.block(0);
} while (true);
}
|
[
"public",
"AsyncWork",
"<",
"OutputResultType",
",",
"OutputErrorType",
">",
"write",
"(",
"InputType",
"data",
")",
"throws",
"IOException",
"{",
"do",
"{",
"SynchronizationPoint",
"<",
"NoException",
">",
"lk",
";",
"synchronized",
"(",
"waiting",
")",
"{",
"// if cancelled or errored, return immediately\r",
"if",
"(",
"error",
"!=",
"null",
")",
"return",
"new",
"AsyncWork",
"<>",
"(",
"null",
",",
"error",
")",
";",
"if",
"(",
"cancelled",
"!=",
"null",
")",
"return",
"new",
"AsyncWork",
"<>",
"(",
"null",
",",
"null",
",",
"cancelled",
")",
";",
"AsyncWork",
"<",
"OutputResultType",
",",
"OutputErrorType",
">",
"op",
";",
"// if ready, write immediately\r",
"if",
"(",
"isReady",
")",
"{",
"isReady",
"=",
"false",
";",
"op",
"=",
"lastWrite",
"=",
"executor",
".",
"execute",
"(",
"data",
")",
";",
"lastWrite",
".",
"listenInline",
"(",
"new",
"WriteListener",
"(",
"data",
",",
"op",
",",
"null",
")",
")",
";",
"return",
"op",
";",
"}",
"// not ready\r",
"if",
"(",
"!",
"waiting",
".",
"isFull",
"(",
")",
")",
"{",
"op",
"=",
"new",
"AsyncWork",
"<>",
"(",
")",
";",
"waiting",
".",
"addLast",
"(",
"new",
"Pair",
"<>",
"(",
"data",
",",
"op",
")",
")",
";",
"lastWrite",
"=",
"op",
";",
"return",
"op",
";",
"}",
"// full\r",
"if",
"(",
"lock",
"!=",
"null",
")",
"throw",
"new",
"IOException",
"(",
"\"Concurrent write\"",
")",
";",
"lock",
"=",
"new",
"SynchronizationPoint",
"<>",
"(",
")",
";",
"lk",
"=",
"lock",
";",
"}",
"lk",
".",
"block",
"(",
"0",
")",
";",
"}",
"while",
"(",
"true",
")",
";",
"}"
] |
Queue the data to write. If there is no pending write, the write operation is started.
If too many write operations are pending, the method is blocking.
@param data the data to write.
|
[
"Queue",
"the",
"data",
"to",
"write",
".",
"If",
"there",
"is",
"no",
"pending",
"write",
"the",
"write",
"operation",
"is",
"started",
".",
"If",
"too",
"many",
"write",
"operations",
"are",
"pending",
"the",
"method",
"is",
"blocking",
"."
] |
b0c893b44bfde2c03f90ea846a49ef5749d598f3
|
https://github.com/lecousin/java-framework-core/blob/b0c893b44bfde2c03f90ea846a49ef5749d598f3/net.lecousin.core/src/main/java/net/lecousin/framework/concurrent/util/LimitAsyncOperations.java#L56-L87
|
150,696
|
GerdHolz/TOVAL
|
src/de/invation/code/toval/debug/Debug.java
|
Debug.newLine
|
public static void newLine(DebugMode mode){
if(debugMode == DebugMode.SILENT)
return;
if(mode.ordinal() >= debugMode.ordinal()){
if(outputMode == OutputMode.SYSOUT){
printStream.println();
} else if(outputMode == OutputMode.FILE){
try {
fileWriter.newLine();
} catch (IOException e) {
printStream.println("Cannot write output to file: I/O Exception");
}
}
}
}
|
java
|
public static void newLine(DebugMode mode){
if(debugMode == DebugMode.SILENT)
return;
if(mode.ordinal() >= debugMode.ordinal()){
if(outputMode == OutputMode.SYSOUT){
printStream.println();
} else if(outputMode == OutputMode.FILE){
try {
fileWriter.newLine();
} catch (IOException e) {
printStream.println("Cannot write output to file: I/O Exception");
}
}
}
}
|
[
"public",
"static",
"void",
"newLine",
"(",
"DebugMode",
"mode",
")",
"{",
"if",
"(",
"debugMode",
"==",
"DebugMode",
".",
"SILENT",
")",
"return",
";",
"if",
"(",
"mode",
".",
"ordinal",
"(",
")",
">=",
"debugMode",
".",
"ordinal",
"(",
")",
")",
"{",
"if",
"(",
"outputMode",
"==",
"OutputMode",
".",
"SYSOUT",
")",
"{",
"printStream",
".",
"println",
"(",
")",
";",
"}",
"else",
"if",
"(",
"outputMode",
"==",
"OutputMode",
".",
"FILE",
")",
"{",
"try",
"{",
"fileWriter",
".",
"newLine",
"(",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"printStream",
".",
"println",
"(",
"\"Cannot write output to file: I/O Exception\"",
")",
";",
"}",
"}",
"}",
"}"
] |
Prints a new line
|
[
"Prints",
"a",
"new",
"line"
] |
036922cdfd710fa53b18e5dbe1e07f226f731fde
|
https://github.com/GerdHolz/TOVAL/blob/036922cdfd710fa53b18e5dbe1e07f226f731fde/src/de/invation/code/toval/debug/Debug.java#L196-L210
|
150,697
|
akarnokd/akarnokd-xml
|
src/main/java/hu/akarnokd/xml/XSerializables.java
|
XSerializables.storeList
|
public static XElement storeList(String container, String item, Iterable<? extends XSerializable> source) {
XElement result = new XElement(container);
for (XSerializable e : source) {
e.save(result.add(item));
}
return result;
}
|
java
|
public static XElement storeList(String container, String item, Iterable<? extends XSerializable> source) {
XElement result = new XElement(container);
for (XSerializable e : source) {
e.save(result.add(item));
}
return result;
}
|
[
"public",
"static",
"XElement",
"storeList",
"(",
"String",
"container",
",",
"String",
"item",
",",
"Iterable",
"<",
"?",
"extends",
"XSerializable",
">",
"source",
")",
"{",
"XElement",
"result",
"=",
"new",
"XElement",
"(",
"container",
")",
";",
"for",
"(",
"XSerializable",
"e",
":",
"source",
")",
"{",
"e",
".",
"save",
"(",
"result",
".",
"add",
"(",
"item",
")",
")",
";",
"}",
"return",
"result",
";",
"}"
] |
Create an XElement with the given name and items stored from the source sequence.
@param container the container name
@param item the item name
@param source the source of items
@return the list in XElement
|
[
"Create",
"an",
"XElement",
"with",
"the",
"given",
"name",
"and",
"items",
"stored",
"from",
"the",
"source",
"sequence",
"."
] |
57466a5a9cb455a13d7121557c165287b31ee870
|
https://github.com/akarnokd/akarnokd-xml/blob/57466a5a9cb455a13d7121557c165287b31ee870/src/main/java/hu/akarnokd/xml/XSerializables.java#L92-L98
|
150,698
|
lecousin/java-framework-core
|
net.lecousin.core/src/main/java/net/lecousin/framework/io/text/DefaultDecoder.java
|
DefaultDecoder.transferTo
|
@Override
public void transferTo(Decoder newDecoder) {
super.transferTo(newDecoder);
if (remainingBytesLength > 0) {
if (currentBuffer == null || !currentBuffer.hasRemaining())
currentBuffer = ByteBuffer.wrap(remainingBytes, 0, remainingBytesLength);
else {
byte[] b = new byte[remainingBytesLength + currentBuffer.remaining()];
System.arraycopy(remainingBytes, 0, b, 0, remainingBytesLength);
currentBuffer.get(b, remainingBytesLength, currentBuffer.remaining());
currentBuffer = ByteBuffer.wrap(b);
}
}
}
|
java
|
@Override
public void transferTo(Decoder newDecoder) {
super.transferTo(newDecoder);
if (remainingBytesLength > 0) {
if (currentBuffer == null || !currentBuffer.hasRemaining())
currentBuffer = ByteBuffer.wrap(remainingBytes, 0, remainingBytesLength);
else {
byte[] b = new byte[remainingBytesLength + currentBuffer.remaining()];
System.arraycopy(remainingBytes, 0, b, 0, remainingBytesLength);
currentBuffer.get(b, remainingBytesLength, currentBuffer.remaining());
currentBuffer = ByteBuffer.wrap(b);
}
}
}
|
[
"@",
"Override",
"public",
"void",
"transferTo",
"(",
"Decoder",
"newDecoder",
")",
"{",
"super",
".",
"transferTo",
"(",
"newDecoder",
")",
";",
"if",
"(",
"remainingBytesLength",
">",
"0",
")",
"{",
"if",
"(",
"currentBuffer",
"==",
"null",
"||",
"!",
"currentBuffer",
".",
"hasRemaining",
"(",
")",
")",
"currentBuffer",
"=",
"ByteBuffer",
".",
"wrap",
"(",
"remainingBytes",
",",
"0",
",",
"remainingBytesLength",
")",
";",
"else",
"{",
"byte",
"[",
"]",
"b",
"=",
"new",
"byte",
"[",
"remainingBytesLength",
"+",
"currentBuffer",
".",
"remaining",
"(",
")",
"]",
";",
"System",
".",
"arraycopy",
"(",
"remainingBytes",
",",
"0",
",",
"b",
",",
"0",
",",
"remainingBytesLength",
")",
";",
"currentBuffer",
".",
"get",
"(",
"b",
",",
"remainingBytesLength",
",",
"currentBuffer",
".",
"remaining",
"(",
")",
")",
";",
"currentBuffer",
"=",
"ByteBuffer",
".",
"wrap",
"(",
"b",
")",
";",
"}",
"}",
"}"
] |
used in case of overflow, but this is usually an error
|
[
"used",
"in",
"case",
"of",
"overflow",
"but",
"this",
"is",
"usually",
"an",
"error"
] |
b0c893b44bfde2c03f90ea846a49ef5749d598f3
|
https://github.com/lecousin/java-framework-core/blob/b0c893b44bfde2c03f90ea846a49ef5749d598f3/net.lecousin.core/src/main/java/net/lecousin/framework/io/text/DefaultDecoder.java#L25-L38
|
150,699
|
vdmeer/skb-java-base
|
src/main/java/de/vandermeer/skb/base/info/AbstractFileInfo.java
|
AbstractFileInfo.tryFS
|
protected final boolean tryFS(String directory, String fileName){
String path = directory + "/" + fileName;
if(directory==null){
path = fileName;
}
File file = new File(path);
if(this.testFile(file)==true){
//found in file system
try{
this.url = file.toURI().toURL();
this.file = file;
this.fullFileName = FilenameUtils.getName(file.getAbsolutePath());
if(directory!=null){
this.setRootPath = directory;
}
return true;
}
catch (MalformedURLException e) {
this.errors.addError("init() - malformed URL for file with name " + this.file.getAbsolutePath() + " and message: " + e.getMessage());
}
}
return false;
}
|
java
|
protected final boolean tryFS(String directory, String fileName){
String path = directory + "/" + fileName;
if(directory==null){
path = fileName;
}
File file = new File(path);
if(this.testFile(file)==true){
//found in file system
try{
this.url = file.toURI().toURL();
this.file = file;
this.fullFileName = FilenameUtils.getName(file.getAbsolutePath());
if(directory!=null){
this.setRootPath = directory;
}
return true;
}
catch (MalformedURLException e) {
this.errors.addError("init() - malformed URL for file with name " + this.file.getAbsolutePath() + " and message: " + e.getMessage());
}
}
return false;
}
|
[
"protected",
"final",
"boolean",
"tryFS",
"(",
"String",
"directory",
",",
"String",
"fileName",
")",
"{",
"String",
"path",
"=",
"directory",
"+",
"\"/\"",
"+",
"fileName",
";",
"if",
"(",
"directory",
"==",
"null",
")",
"{",
"path",
"=",
"fileName",
";",
"}",
"File",
"file",
"=",
"new",
"File",
"(",
"path",
")",
";",
"if",
"(",
"this",
".",
"testFile",
"(",
"file",
")",
"==",
"true",
")",
"{",
"//found in file system",
"try",
"{",
"this",
".",
"url",
"=",
"file",
".",
"toURI",
"(",
")",
".",
"toURL",
"(",
")",
";",
"this",
".",
"file",
"=",
"file",
";",
"this",
".",
"fullFileName",
"=",
"FilenameUtils",
".",
"getName",
"(",
"file",
".",
"getAbsolutePath",
"(",
")",
")",
";",
"if",
"(",
"directory",
"!=",
"null",
")",
"{",
"this",
".",
"setRootPath",
"=",
"directory",
";",
"}",
"return",
"true",
";",
"}",
"catch",
"(",
"MalformedURLException",
"e",
")",
"{",
"this",
".",
"errors",
".",
"addError",
"(",
"\"init() - malformed URL for file with name \"",
"+",
"this",
".",
"file",
".",
"getAbsolutePath",
"(",
")",
"+",
"\" and message: \"",
"+",
"e",
".",
"getMessage",
"(",
")",
")",
";",
"}",
"}",
"return",
"false",
";",
"}"
] |
Try to locate a file in the file system.
@param directory a directory to locate the file in
@param fileName a file name with optional path information
@return true if the file was found, false otherwise
|
[
"Try",
"to",
"locate",
"a",
"file",
"in",
"the",
"file",
"system",
"."
] |
6d845bcc482aa9344d016e80c0c3455aeae13a13
|
https://github.com/vdmeer/skb-java-base/blob/6d845bcc482aa9344d016e80c0c3455aeae13a13/src/main/java/de/vandermeer/skb/base/info/AbstractFileInfo.java#L327-L349
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.