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 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
alipay/sofa-hessian | src/main/java/com/caucho/hessian/io/HessianOutput.java | HessianOutput.removeRef | public boolean removeRef(Object obj)
throws IOException
{
if (_refs != null) {
_refs.remove(obj);
return true;
}
else
return false;
} | java | public boolean removeRef(Object obj)
throws IOException
{
if (_refs != null) {
_refs.remove(obj);
return true;
}
else
return false;
} | [
"public",
"boolean",
"removeRef",
"(",
"Object",
"obj",
")",
"throws",
"IOException",
"{",
"if",
"(",
"_refs",
"!=",
"null",
")",
"{",
"_refs",
".",
"remove",
"(",
"obj",
")",
";",
"return",
"true",
";",
"}",
"else",
"return",
"false",
";",
"}"
] | Removes a reference. | [
"Removes",
"a",
"reference",
"."
] | 89e4f5af28602101dab7b498995018871616357b | https://github.com/alipay/sofa-hessian/blob/89e4f5af28602101dab7b498995018871616357b/src/main/java/com/caucho/hessian/io/HessianOutput.java#L849-L859 | train |
alipay/sofa-hessian | src/main/java/com/caucho/hessian/mux/MuxServer.java | MuxServer.readRequest | public boolean readRequest(MuxInputStream in, MuxOutputStream out)
throws IOException
{
int channel = isClient ? 3 : 2;
in.init(this, channel);
out.init(this, channel);
if (readChannel(channel) != null) {
in.setInputStream(is);
in.readToData(false);
... | java | public boolean readRequest(MuxInputStream in, MuxOutputStream out)
throws IOException
{
int channel = isClient ? 3 : 2;
in.init(this, channel);
out.init(this, channel);
if (readChannel(channel) != null) {
in.setInputStream(is);
in.readToData(false);
... | [
"public",
"boolean",
"readRequest",
"(",
"MuxInputStream",
"in",
",",
"MuxOutputStream",
"out",
")",
"throws",
"IOException",
"{",
"int",
"channel",
"=",
"isClient",
"?",
"3",
":",
"2",
";",
"in",
".",
"init",
"(",
"this",
",",
"channel",
")",
";",
"out"... | Reads a server request. | [
"Reads",
"a",
"server",
"request",
"."
] | 89e4f5af28602101dab7b498995018871616357b | https://github.com/alipay/sofa-hessian/blob/89e4f5af28602101dab7b498995018871616357b/src/main/java/com/caucho/hessian/mux/MuxServer.java#L156-L171 | train |
alipay/sofa-hessian | src/main/java/com/caucho/hessian/mux/MuxServer.java | MuxServer.writeChannel | OutputStream writeChannel(int channel)
throws IOException
{
while (os != null) {
boolean canWrite = false;
synchronized (WRITE_LOCK) {
if (!isWriteLocked) {
isWriteLocked = true;
canWrite = true;
}
... | java | OutputStream writeChannel(int channel)
throws IOException
{
while (os != null) {
boolean canWrite = false;
synchronized (WRITE_LOCK) {
if (!isWriteLocked) {
isWriteLocked = true;
canWrite = true;
}
... | [
"OutputStream",
"writeChannel",
"(",
"int",
"channel",
")",
"throws",
"IOException",
"{",
"while",
"(",
"os",
"!=",
"null",
")",
"{",
"boolean",
"canWrite",
"=",
"false",
";",
"synchronized",
"(",
"WRITE_LOCK",
")",
"{",
"if",
"(",
"!",
"isWriteLocked",
")... | Grabs the channel for writing.
@param channel the channel
@return true if the channel has permission to write. | [
"Grabs",
"the",
"channel",
"for",
"writing",
"."
] | 89e4f5af28602101dab7b498995018871616357b | https://github.com/alipay/sofa-hessian/blob/89e4f5af28602101dab7b498995018871616357b/src/main/java/com/caucho/hessian/mux/MuxServer.java#L180-L208 | train |
alipay/sofa-hessian | src/main/java/com/caucho/hessian/mux/MuxServer.java | MuxServer.readChannel | InputStream readChannel(int channel)
throws IOException
{
while (!isClosed) {
if (inputReady[channel]) {
inputReady[channel] = false;
return is;
}
boolean canRead = false;
synchronized (READ_LOCK) {
if (... | java | InputStream readChannel(int channel)
throws IOException
{
while (!isClosed) {
if (inputReady[channel]) {
inputReady[channel] = false;
return is;
}
boolean canRead = false;
synchronized (READ_LOCK) {
if (... | [
"InputStream",
"readChannel",
"(",
"int",
"channel",
")",
"throws",
"IOException",
"{",
"while",
"(",
"!",
"isClosed",
")",
"{",
"if",
"(",
"inputReady",
"[",
"channel",
"]",
")",
"{",
"inputReady",
"[",
"channel",
"]",
"=",
"false",
";",
"return",
"is",... | Reads data from a channel.
@param channel the channel
@return true if the channel is valid. | [
"Reads",
"data",
"from",
"a",
"channel",
"."
] | 89e4f5af28602101dab7b498995018871616357b | https://github.com/alipay/sofa-hessian/blob/89e4f5af28602101dab7b498995018871616357b/src/main/java/com/caucho/hessian/mux/MuxServer.java#L253-L286 | train |
alipay/sofa-hessian | src/main/java/com/caucho/hessian/mux/MuxServer.java | MuxServer.readData | private void readData()
throws IOException
{
while (!isClosed) {
int code = is.read();
switch (code) {
case ' ':
case '\t':
case '\n':
case '\r':
break;
case 'C': {
... | java | private void readData()
throws IOException
{
while (!isClosed) {
int code = is.read();
switch (code) {
case ' ':
case '\t':
case '\n':
case '\r':
break;
case 'C': {
... | [
"private",
"void",
"readData",
"(",
")",
"throws",
"IOException",
"{",
"while",
"(",
"!",
"isClosed",
")",
"{",
"int",
"code",
"=",
"is",
".",
"read",
"(",
")",
";",
"switch",
"(",
"code",
")",
"{",
"case",
"'",
"'",
":",
"case",
"'",
"'",
":",
... | Reads data until a channel packet 'C' or error 'E' is received. | [
"Reads",
"data",
"until",
"a",
"channel",
"packet",
"C",
"or",
"error",
"E",
"is",
"received",
"."
] | 89e4f5af28602101dab7b498995018871616357b | https://github.com/alipay/sofa-hessian/blob/89e4f5af28602101dab7b498995018871616357b/src/main/java/com/caucho/hessian/mux/MuxServer.java#L320-L361 | train |
alipay/sofa-hessian | src/main/java/com/caucho/hessian/mux/MuxServer.java | MuxServer.close | public void close()
throws IOException
{
isClosed = true;
OutputStream os = this.os;
this.os = null;
InputStream is = this.is;
this.is = null;
if (os != null)
os.close();
if (is != null)
is.close();
} | java | public void close()
throws IOException
{
isClosed = true;
OutputStream os = this.os;
this.os = null;
InputStream is = this.is;
this.is = null;
if (os != null)
os.close();
if (is != null)
is.close();
} | [
"public",
"void",
"close",
"(",
")",
"throws",
"IOException",
"{",
"isClosed",
"=",
"true",
";",
"OutputStream",
"os",
"=",
"this",
".",
"os",
";",
"this",
".",
"os",
"=",
"null",
";",
"InputStream",
"is",
"=",
"this",
".",
"is",
";",
"this",
".",
... | Close the mux | [
"Close",
"the",
"mux"
] | 89e4f5af28602101dab7b498995018871616357b | https://github.com/alipay/sofa-hessian/blob/89e4f5af28602101dab7b498995018871616357b/src/main/java/com/caucho/hessian/mux/MuxServer.java#L366-L382 | train |
alipay/sofa-hessian | src/main/java/com/alipay/hessian/ClassNameResolverBuilder.java | ClassNameResolverBuilder.buildDefault | public static ClassNameResolver buildDefault() {
String enable = System.getProperty(Constants.SERIALIZE_BLACKLIST_ENABLE,
Constants.DEFAULT_SERIALIZE_BLACKLIST_ENABLE);
if (Boolean.TRUE.toString().equalsIgnoreCase(enable)) {
ClassNameResolver resolver = new ClassNameResolver();
... | java | public static ClassNameResolver buildDefault() {
String enable = System.getProperty(Constants.SERIALIZE_BLACKLIST_ENABLE,
Constants.DEFAULT_SERIALIZE_BLACKLIST_ENABLE);
if (Boolean.TRUE.toString().equalsIgnoreCase(enable)) {
ClassNameResolver resolver = new ClassNameResolver();
... | [
"public",
"static",
"ClassNameResolver",
"buildDefault",
"(",
")",
"{",
"String",
"enable",
"=",
"System",
".",
"getProperty",
"(",
"Constants",
".",
"SERIALIZE_BLACKLIST_ENABLE",
",",
"Constants",
".",
"DEFAULT_SERIALIZE_BLACKLIST_ENABLE",
")",
";",
"if",
"(",
"Boo... | Build default ClassNameResolver
@return Default ClassNameResolver | [
"Build",
"default",
"ClassNameResolver"
] | 89e4f5af28602101dab7b498995018871616357b | https://github.com/alipay/sofa-hessian/blob/89e4f5af28602101dab7b498995018871616357b/src/main/java/com/alipay/hessian/ClassNameResolverBuilder.java#L33-L42 | train |
alipay/sofa-hessian | src/main/java/com/alipay/hessian/clhm/ConcurrentLinkedHashMap.java | ConcurrentLinkedHashMap.schedule | private boolean schedule(Task task) {
int index = bufferIndex();
int buffered = bufferLengths.incrementAndGet(index);
if (task.isWrite()) {
buffers[index].add(task);
drainStatus.set(REQUIRED);
return false;
}
// A buffer may discard a read ta... | java | private boolean schedule(Task task) {
int index = bufferIndex();
int buffered = bufferLengths.incrementAndGet(index);
if (task.isWrite()) {
buffers[index].add(task);
drainStatus.set(REQUIRED);
return false;
}
// A buffer may discard a read ta... | [
"private",
"boolean",
"schedule",
"(",
"Task",
"task",
")",
"{",
"int",
"index",
"=",
"bufferIndex",
"(",
")",
";",
"int",
"buffered",
"=",
"bufferLengths",
".",
"incrementAndGet",
"(",
"index",
")",
";",
"if",
"(",
"task",
".",
"isWrite",
"(",
")",
")... | Schedules the task to be applied to the page replacement policy.
@param task the pending operation
@return if the draining of the buffers can be delayed | [
"Schedules",
"the",
"task",
"to",
"be",
"applied",
"to",
"the",
"page",
"replacement",
"policy",
"."
] | 89e4f5af28602101dab7b498995018871616357b | https://github.com/alipay/sofa-hessian/blob/89e4f5af28602101dab7b498995018871616357b/src/main/java/com/alipay/hessian/clhm/ConcurrentLinkedHashMap.java#L359-L377 | train |
alipay/sofa-hessian | src/main/java/com/alipay/hessian/clhm/ConcurrentLinkedHashMap.java | ConcurrentLinkedHashMap.shouldDrainBuffers | boolean shouldDrainBuffers(boolean delayable) {
if (executor.isShutdown()) {
DrainStatus status = drainStatus.get();
return (status != PROCESSING) && (!delayable || (status == REQUIRED));
}
return false;
} | java | boolean shouldDrainBuffers(boolean delayable) {
if (executor.isShutdown()) {
DrainStatus status = drainStatus.get();
return (status != PROCESSING) && (!delayable || (status == REQUIRED));
}
return false;
} | [
"boolean",
"shouldDrainBuffers",
"(",
"boolean",
"delayable",
")",
"{",
"if",
"(",
"executor",
".",
"isShutdown",
"(",
")",
")",
"{",
"DrainStatus",
"status",
"=",
"drainStatus",
".",
"get",
"(",
")",
";",
"return",
"(",
"status",
"!=",
"PROCESSING",
")",
... | Determines whether the buffers should be drained.
@param delayable if a drain should be delayed until required
@return if a drain should be attempted | [
"Determines",
"whether",
"the",
"buffers",
"should",
"be",
"drained",
"."
] | 89e4f5af28602101dab7b498995018871616357b | https://github.com/alipay/sofa-hessian/blob/89e4f5af28602101dab7b498995018871616357b/src/main/java/com/alipay/hessian/clhm/ConcurrentLinkedHashMap.java#L401-L407 | train |
alipay/sofa-hessian | src/main/java/com/alipay/hessian/clhm/ConcurrentLinkedHashMap.java | ConcurrentLinkedHashMap.drainBuffers | @GuardedBy("evictionLock")
void drainBuffers(int maxToDrain) {
// A mostly strict ordering is achieved by observing that each buffer
// contains tasks in a weakly sorted order starting from the last drain.
// The buffers can be merged into a sorted list in O(n) time by using
// count... | java | @GuardedBy("evictionLock")
void drainBuffers(int maxToDrain) {
// A mostly strict ordering is achieved by observing that each buffer
// contains tasks in a weakly sorted order starting from the last drain.
// The buffers can be merged into a sorted list in O(n) time by using
// count... | [
"@",
"GuardedBy",
"(",
"\"evictionLock\"",
")",
"void",
"drainBuffers",
"(",
"int",
"maxToDrain",
")",
"{",
"// A mostly strict ordering is achieved by observing that each buffer",
"// contains tasks in a weakly sorted order starting from the last drain.",
"// The buffers can be merged i... | Drains the buffers and applies the pending operations.
@param maxToDrain the maximum number of operations to drain | [
"Drains",
"the",
"buffers",
"and",
"applies",
"the",
"pending",
"operations",
"."
] | 89e4f5af28602101dab7b498995018871616357b | https://github.com/alipay/sofa-hessian/blob/89e4f5af28602101dab7b498995018871616357b/src/main/java/com/alipay/hessian/clhm/ConcurrentLinkedHashMap.java#L432-L448 | train |
alipay/sofa-hessian | src/main/java/com/alipay/hessian/clhm/ConcurrentLinkedHashMap.java | ConcurrentLinkedHashMap.runTasksInChain | @GuardedBy("evictionLock")
void runTasksInChain(Task task) {
while (task != null) {
Task current = task;
task = task.getNext();
current.setNext(null);
current.run();
}
} | java | @GuardedBy("evictionLock")
void runTasksInChain(Task task) {
while (task != null) {
Task current = task;
task = task.getNext();
current.setNext(null);
current.run();
}
} | [
"@",
"GuardedBy",
"(",
"\"evictionLock\"",
")",
"void",
"runTasksInChain",
"(",
"Task",
"task",
")",
"{",
"while",
"(",
"task",
"!=",
"null",
")",
"{",
"Task",
"current",
"=",
"task",
";",
"task",
"=",
"task",
".",
"getNext",
"(",
")",
";",
"current",
... | Runs the pending operations on the linked chain.
@param task the first task in the chain of operations | [
"Runs",
"the",
"pending",
"operations",
"on",
"the",
"linked",
"chain",
"."
] | 89e4f5af28602101dab7b498995018871616357b | https://github.com/alipay/sofa-hessian/blob/89e4f5af28602101dab7b498995018871616357b/src/main/java/com/alipay/hessian/clhm/ConcurrentLinkedHashMap.java#L539-L547 | train |
alipay/sofa-hessian | src/main/java/com/caucho/hessian/micro/MicroHessianInput.java | MicroHessianInput.readStringImpl | protected String readStringImpl(int length)
throws IOException
{
StringBuffer sb = new StringBuffer();
for (int i = 0; i < length; i++) {
int ch = is.read();
if (ch < 0x80)
sb.append((char) ch);
else if ((ch & 0xe0) == 0xc0) {
... | java | protected String readStringImpl(int length)
throws IOException
{
StringBuffer sb = new StringBuffer();
for (int i = 0; i < length; i++) {
int ch = is.read();
if (ch < 0x80)
sb.append((char) ch);
else if ((ch & 0xe0) == 0xc0) {
... | [
"protected",
"String",
"readStringImpl",
"(",
"int",
"length",
")",
"throws",
"IOException",
"{",
"StringBuffer",
"sb",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"i... | Reads a string from the underlying stream. | [
"Reads",
"a",
"string",
"from",
"the",
"underlying",
"stream",
"."
] | 89e4f5af28602101dab7b498995018871616357b | https://github.com/alipay/sofa-hessian/blob/89e4f5af28602101dab7b498995018871616357b/src/main/java/com/caucho/hessian/micro/MicroHessianInput.java#L415-L443 | train |
alipay/sofa-hessian | src/main/java/com/caucho/hessian/io/Hessian2Output.java | Hessian2Output.startEnvelope | public void startEnvelope(String method)
throws IOException
{
int offset = _offset;
if (SIZE < offset + 32) {
flushBuffer();
offset = _offset;
}
_buffer[_offset++] = (byte) 'E';
writeString(method);
} | java | public void startEnvelope(String method)
throws IOException
{
int offset = _offset;
if (SIZE < offset + 32) {
flushBuffer();
offset = _offset;
}
_buffer[_offset++] = (byte) 'E';
writeString(method);
} | [
"public",
"void",
"startEnvelope",
"(",
"String",
"method",
")",
"throws",
"IOException",
"{",
"int",
"offset",
"=",
"_offset",
";",
"if",
"(",
"SIZE",
"<",
"offset",
"+",
"32",
")",
"{",
"flushBuffer",
"(",
")",
";",
"offset",
"=",
"_offset",
";",
"}"... | Starts an envelope.
<code><pre>
E major minor
m b16 b8 method-name
</pre></code>
@param method the method name to call. | [
"Starts",
"an",
"envelope",
"."
] | 89e4f5af28602101dab7b498995018871616357b | https://github.com/alipay/sofa-hessian/blob/89e4f5af28602101dab7b498995018871616357b/src/main/java/com/caucho/hessian/io/Hessian2Output.java#L250-L263 | train |
alipay/sofa-hessian | src/main/java/com/caucho/hessian/io/Hessian2Output.java | Hessian2Output.writeObjectBegin | @Override
public int writeObjectBegin(String type)
throws IOException
{
int newRef = _classRefs.size();
int ref = _classRefs.put(type, newRef, false);
if (newRef != ref) {
if (SIZE < _offset + 32)
flushBuffer();
if (ref <= OBJECT_DIRECT_M... | java | @Override
public int writeObjectBegin(String type)
throws IOException
{
int newRef = _classRefs.size();
int ref = _classRefs.put(type, newRef, false);
if (newRef != ref) {
if (SIZE < _offset + 32)
flushBuffer();
if (ref <= OBJECT_DIRECT_M... | [
"@",
"Override",
"public",
"int",
"writeObjectBegin",
"(",
"String",
"type",
")",
"throws",
"IOException",
"{",
"int",
"newRef",
"=",
"_classRefs",
".",
"size",
"(",
")",
";",
"int",
"ref",
"=",
"_classRefs",
".",
"put",
"(",
"type",
",",
"newRef",
",",
... | Writes the object definition
<code><pre>
C <string> <int> <string>*
</pre></code> | [
"Writes",
"the",
"object",
"definition"
] | 89e4f5af28602101dab7b498995018871616357b | https://github.com/alipay/sofa-hessian/blob/89e4f5af28602101dab7b498995018871616357b/src/main/java/com/caucho/hessian/io/Hessian2Output.java#L573-L604 | train |
alipay/sofa-hessian | src/main/java/com/caucho/hessian/io/Hessian2Output.java | Hessian2Output.writeNull | public void writeNull()
throws IOException
{
int offset = _offset;
byte[] buffer = _buffer;
if (SIZE <= offset + 16) {
flushBuffer();
offset = _offset;
}
buffer[offset++] = 'N';
_offset = offset;
} | java | public void writeNull()
throws IOException
{
int offset = _offset;
byte[] buffer = _buffer;
if (SIZE <= offset + 16) {
flushBuffer();
offset = _offset;
}
buffer[offset++] = 'N';
_offset = offset;
} | [
"public",
"void",
"writeNull",
"(",
")",
"throws",
"IOException",
"{",
"int",
"offset",
"=",
"_offset",
";",
"byte",
"[",
"]",
"buffer",
"=",
"_buffer",
";",
"if",
"(",
"SIZE",
"<=",
"offset",
"+",
"16",
")",
"{",
"flushBuffer",
"(",
")",
";",
"offse... | Writes a null value to the stream.
The null will be written with the following syntax
<code><pre>
N
</pre></code>
@param value the string value to write. | [
"Writes",
"a",
"null",
"value",
"to",
"the",
"stream",
".",
"The",
"null",
"will",
"be",
"written",
"with",
"the",
"following",
"syntax"
] | 89e4f5af28602101dab7b498995018871616357b | https://github.com/alipay/sofa-hessian/blob/89e4f5af28602101dab7b498995018871616357b/src/main/java/com/caucho/hessian/io/Hessian2Output.java#L930-L944 | train |
alipay/sofa-hessian | src/main/java/com/caucho/hessian/io/Hessian2Output.java | Hessian2Output.writeByteStream | @Override
public void writeByteStream(InputStream is)
throws IOException
{
while (true) {
int len = SIZE - _offset - 3;
if (len < 16) {
flushBuffer();
len = SIZE - _offset - 3;
}
len = is.read(_buffer, _offset + 3,... | java | @Override
public void writeByteStream(InputStream is)
throws IOException
{
while (true) {
int len = SIZE - _offset - 3;
if (len < 16) {
flushBuffer();
len = SIZE - _offset - 3;
}
len = is.read(_buffer, _offset + 3,... | [
"@",
"Override",
"public",
"void",
"writeByteStream",
"(",
"InputStream",
"is",
")",
"throws",
"IOException",
"{",
"while",
"(",
"true",
")",
"{",
"int",
"len",
"=",
"SIZE",
"-",
"_offset",
"-",
"3",
";",
"if",
"(",
"len",
"<",
"16",
")",
"{",
"flush... | Writes a full output stream. | [
"Writes",
"a",
"full",
"output",
"stream",
"."
] | 89e4f5af28602101dab7b498995018871616357b | https://github.com/alipay/sofa-hessian/blob/89e4f5af28602101dab7b498995018871616357b/src/main/java/com/caucho/hessian/io/Hessian2Output.java#L1272-L1297 | train |
alipay/sofa-hessian | src/main/java/com/caucho/hessian/io/Hessian2Output.java | Hessian2Output.startPacket | public void startPacket()
throws IOException
{
if (_refs != null) {
_refs.clear();
_refCount = 0;
}
flushBuffer();
_isPacket = true;
_offset = 4;
_buffer[0] = (byte) 0x05; // 0x05 = binary
_buffer[1] = (byte) 0x55;
_bu... | java | public void startPacket()
throws IOException
{
if (_refs != null) {
_refs.clear();
_refCount = 0;
}
flushBuffer();
_isPacket = true;
_offset = 4;
_buffer[0] = (byte) 0x05; // 0x05 = binary
_buffer[1] = (byte) 0x55;
_bu... | [
"public",
"void",
"startPacket",
"(",
")",
"throws",
"IOException",
"{",
"if",
"(",
"_refs",
"!=",
"null",
")",
"{",
"_refs",
".",
"clear",
"(",
")",
";",
"_refCount",
"=",
"0",
";",
"}",
"flushBuffer",
"(",
")",
";",
"_isPacket",
"=",
"true",
";",
... | Starts a streaming packet
<p>A streaming contains a set of chunks, ending with a zero chunk.
Each chunk is a length followed by data where the length is
encoded by (b1xxxxxxxx)* b0xxxxxxxx</p> | [
"Starts",
"a",
"streaming",
"packet"
] | 89e4f5af28602101dab7b498995018871616357b | https://github.com/alipay/sofa-hessian/blob/89e4f5af28602101dab7b498995018871616357b/src/main/java/com/caucho/hessian/io/Hessian2Output.java#L1435-L1451 | train |
alipay/sofa-hessian | src/main/java/com/caucho/hessian/io/Hessian2Output.java | Hessian2Output.reset | public void reset()
{
if (_refs != null) {
_refs.clear();
_refCount = 0;
}
_classRefs.clear();
_typeRefs = null;
_offset = 0;
_isPacket = false;
_isUnshared = false;
} | java | public void reset()
{
if (_refs != null) {
_refs.clear();
_refCount = 0;
}
_classRefs.clear();
_typeRefs = null;
_offset = 0;
_isPacket = false;
_isUnshared = false;
} | [
"public",
"void",
"reset",
"(",
")",
"{",
"if",
"(",
"_refs",
"!=",
"null",
")",
"{",
"_refs",
".",
"clear",
"(",
")",
";",
"_refCount",
"=",
"0",
";",
"}",
"_classRefs",
".",
"clear",
"(",
")",
";",
"_typeRefs",
"=",
"null",
";",
"_offset",
"=",... | Resets all counters and references | [
"Resets",
"all",
"counters",
"and",
"references"
] | 89e4f5af28602101dab7b498995018871616357b | https://github.com/alipay/sofa-hessian/blob/89e4f5af28602101dab7b498995018871616357b/src/main/java/com/caucho/hessian/io/Hessian2Output.java#L1685-L1697 | train |
alipay/sofa-hessian | src/main/java/com/caucho/hessian/io/HessianDebugInputStream.java | HessianDebugInputStream.read | public int read()
throws IOException
{
int ch;
InputStream is = _is;
if (is == null)
return -1;
else {
ch = is.read();
}
_state.next(ch);
return ch;
} | java | public int read()
throws IOException
{
int ch;
InputStream is = _is;
if (is == null)
return -1;
else {
ch = is.read();
}
_state.next(ch);
return ch;
} | [
"public",
"int",
"read",
"(",
")",
"throws",
"IOException",
"{",
"int",
"ch",
";",
"InputStream",
"is",
"=",
"_is",
";",
"if",
"(",
"is",
"==",
"null",
")",
"return",
"-",
"1",
";",
"else",
"{",
"ch",
"=",
"is",
".",
"read",
"(",
")",
";",
"}",... | Reads a character. | [
"Reads",
"a",
"character",
"."
] | 89e4f5af28602101dab7b498995018871616357b | https://github.com/alipay/sofa-hessian/blob/89e4f5af28602101dab7b498995018871616357b/src/main/java/com/caucho/hessian/io/HessianDebugInputStream.java#L135-L151 | train |
alipay/sofa-hessian | src/main/java/com/caucho/hessian/io/HessianFactory.java | HessianFactory.freeHessian2Input | public void freeHessian2Input(Hessian2Input in)
{
if (in == null)
return;
in.free();
_freeHessian2Input.free(in);
} | java | public void freeHessian2Input(Hessian2Input in)
{
if (in == null)
return;
in.free();
_freeHessian2Input.free(in);
} | [
"public",
"void",
"freeHessian2Input",
"(",
"Hessian2Input",
"in",
")",
"{",
"if",
"(",
"in",
"==",
"null",
")",
"return",
";",
"in",
".",
"free",
"(",
")",
";",
"_freeHessian2Input",
".",
"free",
"(",
"in",
")",
";",
"}"
] | Frees a Hessian 2.0 deserializer | [
"Frees",
"a",
"Hessian",
"2",
".",
"0",
"deserializer"
] | 89e4f5af28602101dab7b498995018871616357b | https://github.com/alipay/sofa-hessian/blob/89e4f5af28602101dab7b498995018871616357b/src/main/java/com/caucho/hessian/io/HessianFactory.java#L132-L140 | train |
alipay/sofa-hessian | src/main/java/com/caucho/hessian/io/HessianFactory.java | HessianFactory.freeHessian2Output | public void freeHessian2Output(Hessian2Output out)
{
if (out == null)
return;
out.free();
_freeHessian2Output.free(out);
} | java | public void freeHessian2Output(Hessian2Output out)
{
if (out == null)
return;
out.free();
_freeHessian2Output.free(out);
} | [
"public",
"void",
"freeHessian2Output",
"(",
"Hessian2Output",
"out",
")",
"{",
"if",
"(",
"out",
"==",
"null",
")",
"return",
";",
"out",
".",
"free",
"(",
")",
";",
"_freeHessian2Output",
".",
"free",
"(",
"out",
")",
";",
"}"
] | Frees a Hessian 2.0 serializer | [
"Frees",
"a",
"Hessian",
"2",
".",
"0",
"serializer"
] | 89e4f5af28602101dab7b498995018871616357b | https://github.com/alipay/sofa-hessian/blob/89e4f5af28602101dab7b498995018871616357b/src/main/java/com/caucho/hessian/io/HessianFactory.java#L199-L207 | train |
alipay/sofa-hessian | src/main/java/com/caucho/hessian/io/HessianInput.java | HessianInput.init | public void init(InputStream is)
{
_is = is;
_method = null;
_isLastChunk = true;
_chunkLength = 0;
_peek = -1;
_refs = null;
_replyFault = null;
if (_serializerFactory == null)
_serializerFactory = new SerializerFactory();
} | java | public void init(InputStream is)
{
_is = is;
_method = null;
_isLastChunk = true;
_chunkLength = 0;
_peek = -1;
_refs = null;
_replyFault = null;
if (_serializerFactory == null)
_serializerFactory = new SerializerFactory();
} | [
"public",
"void",
"init",
"(",
"InputStream",
"is",
")",
"{",
"_is",
"=",
"is",
";",
"_method",
"=",
"null",
";",
"_isLastChunk",
"=",
"true",
";",
"_chunkLength",
"=",
"0",
";",
"_peek",
"=",
"-",
"1",
";",
"_refs",
"=",
"null",
";",
"_replyFault",
... | Initialize the hessian stream with the underlying input stream. | [
"Initialize",
"the",
"hessian",
"stream",
"with",
"the",
"underlying",
"input",
"stream",
"."
] | 89e4f5af28602101dab7b498995018871616357b | https://github.com/alipay/sofa-hessian/blob/89e4f5af28602101dab7b498995018871616357b/src/main/java/com/caucho/hessian/io/HessianInput.java#L143-L155 | train |
alipay/sofa-hessian | src/main/java/com/caucho/hessian/io/HessianInput.java | HessianInput.readReply | public Object readReply(Class expectedClass)
throws Throwable
{
int tag = read();
if (tag != 'r')
error("expected hessian reply at " + codeName(tag));
int major = read();
int minor = read();
tag = read();
if (tag == 'f')
throw prepar... | java | public Object readReply(Class expectedClass)
throws Throwable
{
int tag = read();
if (tag != 'r')
error("expected hessian reply at " + codeName(tag));
int major = read();
int minor = read();
tag = read();
if (tag == 'f')
throw prepar... | [
"public",
"Object",
"readReply",
"(",
"Class",
"expectedClass",
")",
"throws",
"Throwable",
"{",
"int",
"tag",
"=",
"read",
"(",
")",
";",
"if",
"(",
"tag",
"!=",
"'",
"'",
")",
"error",
"(",
"\"expected hessian reply at \"",
"+",
"codeName",
"(",
"tag",
... | Reads a reply as an object.
If the reply has a fault, throws the exception. | [
"Reads",
"a",
"reply",
"as",
"an",
"object",
".",
"If",
"the",
"reply",
"has",
"a",
"fault",
"throws",
"the",
"exception",
"."
] | 89e4f5af28602101dab7b498995018871616357b | https://github.com/alipay/sofa-hessian/blob/89e4f5af28602101dab7b498995018871616357b/src/main/java/com/caucho/hessian/io/HessianInput.java#L288-L311 | train |
alipay/sofa-hessian | src/main/java/com/caucho/hessian/io/HessianInput.java | HessianInput.prepareFault | private Throwable prepareFault()
throws IOException
{
HashMap fault = readFault();
Object detail = fault.get("detail");
String message = (String) fault.get("message");
if (detail instanceof Throwable) {
_replyFault = (Throwable) detail;
if (message ... | java | private Throwable prepareFault()
throws IOException
{
HashMap fault = readFault();
Object detail = fault.get("detail");
String message = (String) fault.get("message");
if (detail instanceof Throwable) {
_replyFault = (Throwable) detail;
if (message ... | [
"private",
"Throwable",
"prepareFault",
"(",
")",
"throws",
"IOException",
"{",
"HashMap",
"fault",
"=",
"readFault",
"(",
")",
";",
"Object",
"detail",
"=",
"fault",
".",
"get",
"(",
"\"detail\"",
")",
";",
"String",
"message",
"=",
"(",
"String",
")",
... | Prepares the fault. | [
"Prepares",
"the",
"fault",
"."
] | 89e4f5af28602101dab7b498995018871616357b | https://github.com/alipay/sofa-hessian/blob/89e4f5af28602101dab7b498995018871616357b/src/main/java/com/caucho/hessian/io/HessianInput.java#L350-L378 | train |
alipay/sofa-hessian | src/main/java/com/caucho/hessian/io/HessianInput.java | HessianInput.readHeader | public String readHeader()
throws IOException
{
int tag = read();
if (tag == 'H') {
_isLastChunk = true;
_chunkLength = (read() << 8) + read();
_sbuf.setLength(0);
int ch;
while ((ch = parseChar()) >= 0)
_sbuf.appe... | java | public String readHeader()
throws IOException
{
int tag = read();
if (tag == 'H') {
_isLastChunk = true;
_chunkLength = (read() << 8) + read();
_sbuf.setLength(0);
int ch;
while ((ch = parseChar()) >= 0)
_sbuf.appe... | [
"public",
"String",
"readHeader",
"(",
")",
"throws",
"IOException",
"{",
"int",
"tag",
"=",
"read",
"(",
")",
";",
"if",
"(",
"tag",
"==",
"'",
"'",
")",
"{",
"_isLastChunk",
"=",
"true",
";",
"_chunkLength",
"=",
"(",
"read",
"(",
")",
"<<",
"8",... | Reads a header, returning null if there are no headers.
<pre>
H b16 b8 value
</pre> | [
"Reads",
"a",
"header",
"returning",
"null",
"if",
"there",
"are",
"no",
"headers",
"."
] | 89e4f5af28602101dab7b498995018871616357b | https://github.com/alipay/sofa-hessian/blob/89e4f5af28602101dab7b498995018871616357b/src/main/java/com/caucho/hessian/io/HessianInput.java#L423-L443 | train |
alipay/sofa-hessian | src/main/java/com/caucho/hessian/io/HessianInput.java | HessianInput.readUTCDate | public long readUTCDate()
throws IOException
{
int tag = read();
if (tag != 'd')
throw error("expected date at " + codeName(tag));
long b64 = read();
long b56 = read();
long b48 = read();
long b40 = read();
long b32 = read();
long... | java | public long readUTCDate()
throws IOException
{
int tag = read();
if (tag != 'd')
throw error("expected date at " + codeName(tag));
long b64 = read();
long b56 = read();
long b48 = read();
long b40 = read();
long b32 = read();
long... | [
"public",
"long",
"readUTCDate",
"(",
")",
"throws",
"IOException",
"{",
"int",
"tag",
"=",
"read",
"(",
")",
";",
"if",
"(",
"tag",
"!=",
"'",
"'",
")",
"throw",
"error",
"(",
"\"expected date at \"",
"+",
"codeName",
"(",
"tag",
")",
")",
";",
"lon... | Reads a date.
<pre>
T b64 b56 b48 b40 b32 b24 b16 b8
</pre> | [
"Reads",
"a",
"date",
"."
] | 89e4f5af28602101dab7b498995018871616357b | https://github.com/alipay/sofa-hessian/blob/89e4f5af28602101dab7b498995018871616357b/src/main/java/com/caucho/hessian/io/HessianInput.java#L633-L657 | train |
alipay/sofa-hessian | src/main/java/com/caucho/hessian/io/HessianInput.java | HessianInput.readNode | public org.w3c.dom.Node readNode()
throws IOException
{
int tag = read();
switch (tag) {
case 'N':
return null;
case 'S':
case 's':
case 'X':
case 'x':
_isLastChunk = tag == 'S' || tag == 'X';
... | java | public org.w3c.dom.Node readNode()
throws IOException
{
int tag = read();
switch (tag) {
case 'N':
return null;
case 'S':
case 's':
case 'X':
case 'x':
_isLastChunk = tag == 'S' || tag == 'X';
... | [
"public",
"org",
".",
"w3c",
".",
"dom",
".",
"Node",
"readNode",
"(",
")",
"throws",
"IOException",
"{",
"int",
"tag",
"=",
"read",
"(",
")",
";",
"switch",
"(",
"tag",
")",
"{",
"case",
"'",
"'",
":",
"return",
"null",
";",
"case",
"'",
"'",
... | Reads an XML node.
<pre>
S b16 b8 string value
</pre> | [
"Reads",
"an",
"XML",
"node",
"."
] | 89e4f5af28602101dab7b498995018871616357b | https://github.com/alipay/sofa-hessian/blob/89e4f5af28602101dab7b498995018871616357b/src/main/java/com/caucho/hessian/io/HessianInput.java#L831-L852 | train |
alipay/sofa-hessian | src/main/java/com/caucho/hessian/io/HessianInput.java | HessianInput.readFault | private HashMap readFault()
throws IOException
{
HashMap map = new HashMap();
int code = read();
for (; code > 0 && code != 'z'; code = read()) {
_peek = code;
Object key = readObject();
Object value = readObject();
if (key != null &... | java | private HashMap readFault()
throws IOException
{
HashMap map = new HashMap();
int code = read();
for (; code > 0 && code != 'z'; code = read()) {
_peek = code;
Object key = readObject();
Object value = readObject();
if (key != null &... | [
"private",
"HashMap",
"readFault",
"(",
")",
"throws",
"IOException",
"{",
"HashMap",
"map",
"=",
"new",
"HashMap",
"(",
")",
";",
"int",
"code",
"=",
"read",
"(",
")",
";",
"for",
"(",
";",
"code",
">",
"0",
"&&",
"code",
"!=",
"'",
"'",
";",
"c... | Reads a fault. | [
"Reads",
"a",
"fault",
"."
] | 89e4f5af28602101dab7b498995018871616357b | https://github.com/alipay/sofa-hessian/blob/89e4f5af28602101dab7b498995018871616357b/src/main/java/com/caucho/hessian/io/HessianInput.java#L1005-L1025 | train |
alipay/sofa-hessian | src/main/java/com/caucho/hessian/io/HessianInput.java | HessianInput.readObject | public Object readObject(Class cl)
throws IOException
{
if (cl == null || cl == Object.class)
return readObject();
int tag = read();
switch (tag) {
case 'N':
return null;
case 'M': {
String type = readType();
... | java | public Object readObject(Class cl)
throws IOException
{
if (cl == null || cl == Object.class)
return readObject();
int tag = read();
switch (tag) {
case 'N':
return null;
case 'M': {
String type = readType();
... | [
"public",
"Object",
"readObject",
"(",
"Class",
"cl",
")",
"throws",
"IOException",
"{",
"if",
"(",
"cl",
"==",
"null",
"||",
"cl",
"==",
"Object",
".",
"class",
")",
"return",
"readObject",
"(",
")",
";",
"int",
"tag",
"=",
"read",
"(",
")",
";",
... | Reads an object from the input stream with an expected type. | [
"Reads",
"an",
"object",
"from",
"the",
"input",
"stream",
"with",
"an",
"expected",
"type",
"."
] | 89e4f5af28602101dab7b498995018871616357b | https://github.com/alipay/sofa-hessian/blob/89e4f5af28602101dab7b498995018871616357b/src/main/java/com/caucho/hessian/io/HessianInput.java#L1030-L1099 | train |
alipay/sofa-hessian | src/main/java/com/caucho/hessian/io/HessianInput.java | HessianInput.readObject | public Object readObject()
throws IOException
{
int tag = read();
switch (tag) {
case 'N':
return null;
case 'T':
return Boolean.valueOf(true);
case 'F':
return Boolean.valueOf(false);
case 'I... | java | public Object readObject()
throws IOException
{
int tag = read();
switch (tag) {
case 'N':
return null;
case 'T':
return Boolean.valueOf(true);
case 'F':
return Boolean.valueOf(false);
case 'I... | [
"public",
"Object",
"readObject",
"(",
")",
"throws",
"IOException",
"{",
"int",
"tag",
"=",
"read",
"(",
")",
";",
"switch",
"(",
"tag",
")",
"{",
"case",
"'",
"'",
":",
"return",
"null",
";",
"case",
"'",
"'",
":",
"return",
"Boolean",
".",
"valu... | Reads an arbitrary object from the input stream when the type
is unknown. | [
"Reads",
"an",
"arbitrary",
"object",
"from",
"the",
"input",
"stream",
"when",
"the",
"type",
"is",
"unknown",
"."
] | 89e4f5af28602101dab7b498995018871616357b | https://github.com/alipay/sofa-hessian/blob/89e4f5af28602101dab7b498995018871616357b/src/main/java/com/caucho/hessian/io/HessianInput.java#L1105-L1197 | train |
alipay/sofa-hessian | src/main/java/com/caucho/hessian/io/HessianInput.java | HessianInput.readRemote | public Object readRemote()
throws IOException
{
String type = readType();
String url = readString();
return resolveRemote(type, url);
} | java | public Object readRemote()
throws IOException
{
String type = readType();
String url = readString();
return resolveRemote(type, url);
} | [
"public",
"Object",
"readRemote",
"(",
")",
"throws",
"IOException",
"{",
"String",
"type",
"=",
"readType",
"(",
")",
";",
"String",
"url",
"=",
"readString",
"(",
")",
";",
"return",
"resolveRemote",
"(",
"type",
",",
"url",
")",
";",
"}"
] | Reads a remote object. | [
"Reads",
"a",
"remote",
"object",
"."
] | 89e4f5af28602101dab7b498995018871616357b | https://github.com/alipay/sofa-hessian/blob/89e4f5af28602101dab7b498995018871616357b/src/main/java/com/caucho/hessian/io/HessianInput.java#L1202-L1209 | train |
alipay/sofa-hessian | src/main/java/com/caucho/hessian/io/HessianInput.java | HessianInput.resolveRemote | public Object resolveRemote(String type, String url)
throws IOException
{
HessianRemoteResolver resolver = getRemoteResolver();
if (resolver != null)
return resolver.lookup(type, url);
else
return new HessianRemote(type, url);
} | java | public Object resolveRemote(String type, String url)
throws IOException
{
HessianRemoteResolver resolver = getRemoteResolver();
if (resolver != null)
return resolver.lookup(type, url);
else
return new HessianRemote(type, url);
} | [
"public",
"Object",
"resolveRemote",
"(",
"String",
"type",
",",
"String",
"url",
")",
"throws",
"IOException",
"{",
"HessianRemoteResolver",
"resolver",
"=",
"getRemoteResolver",
"(",
")",
";",
"if",
"(",
"resolver",
"!=",
"null",
")",
"return",
"resolver",
"... | Resolves a remote object. | [
"Resolves",
"a",
"remote",
"object",
"."
] | 89e4f5af28602101dab7b498995018871616357b | https://github.com/alipay/sofa-hessian/blob/89e4f5af28602101dab7b498995018871616357b/src/main/java/com/caucho/hessian/io/HessianInput.java#L1320-L1329 | train |
alipay/sofa-hessian | src/main/java/com/caucho/hessian/io/HessianInput.java | HessianInput.readType | public String readType()
throws IOException
{
int code = read();
if (code != 't') {
_peek = code;
return "";
}
_isLastChunk = true;
_chunkLength = (read() << 8) + read();
_sbuf.setLength(0);
int ch;
while ((ch = parse... | java | public String readType()
throws IOException
{
int code = read();
if (code != 't') {
_peek = code;
return "";
}
_isLastChunk = true;
_chunkLength = (read() << 8) + read();
_sbuf.setLength(0);
int ch;
while ((ch = parse... | [
"public",
"String",
"readType",
"(",
")",
"throws",
"IOException",
"{",
"int",
"code",
"=",
"read",
"(",
")",
";",
"if",
"(",
"code",
"!=",
"'",
"'",
")",
"{",
"_peek",
"=",
"code",
";",
"return",
"\"\"",
";",
"}",
"_isLastChunk",
"=",
"true",
";",... | Parses a type from the stream.
<pre>
t b16 b8
</pre> | [
"Parses",
"a",
"type",
"from",
"the",
"stream",
"."
] | 89e4f5af28602101dab7b498995018871616357b | https://github.com/alipay/sofa-hessian/blob/89e4f5af28602101dab7b498995018871616357b/src/main/java/com/caucho/hessian/io/HessianInput.java#L1338-L1357 | train |
alipay/sofa-hessian | src/main/java/com/caucho/hessian/io/HessianInput.java | HessianInput.parseInt | private int parseInt()
throws IOException
{
int b32 = read();
int b24 = read();
int b16 = read();
int b8 = read();
return (b32 << 24) + (b24 << 16) + (b16 << 8) + b8;
} | java | private int parseInt()
throws IOException
{
int b32 = read();
int b24 = read();
int b16 = read();
int b8 = read();
return (b32 << 24) + (b24 << 16) + (b16 << 8) + b8;
} | [
"private",
"int",
"parseInt",
"(",
")",
"throws",
"IOException",
"{",
"int",
"b32",
"=",
"read",
"(",
")",
";",
"int",
"b24",
"=",
"read",
"(",
")",
";",
"int",
"b16",
"=",
"read",
"(",
")",
";",
"int",
"b8",
"=",
"read",
"(",
")",
";",
"return... | Parses a 32-bit integer value from the stream.
<pre>
b32 b24 b16 b8
</pre> | [
"Parses",
"a",
"32",
"-",
"bit",
"integer",
"value",
"from",
"the",
"stream",
"."
] | 89e4f5af28602101dab7b498995018871616357b | https://github.com/alipay/sofa-hessian/blob/89e4f5af28602101dab7b498995018871616357b/src/main/java/com/caucho/hessian/io/HessianInput.java#L1386-L1395 | train |
alipay/sofa-hessian | src/main/java/com/caucho/hessian/io/HessianInput.java | HessianInput.parseLong | private long parseLong()
throws IOException
{
long b64 = read();
long b56 = read();
long b48 = read();
long b40 = read();
long b32 = read();
long b24 = read();
long b16 = read();
long b8 = read();
return ((b64 << 56) +
(b56... | java | private long parseLong()
throws IOException
{
long b64 = read();
long b56 = read();
long b48 = read();
long b40 = read();
long b32 = read();
long b24 = read();
long b16 = read();
long b8 = read();
return ((b64 << 56) +
(b56... | [
"private",
"long",
"parseLong",
"(",
")",
"throws",
"IOException",
"{",
"long",
"b64",
"=",
"read",
"(",
")",
";",
"long",
"b56",
"=",
"read",
"(",
")",
";",
"long",
"b48",
"=",
"read",
"(",
")",
";",
"long",
"b40",
"=",
"read",
"(",
")",
";",
... | Parses a 64-bit long value from the stream.
<pre>
b64 b56 b48 b40 b32 b24 b16 b8
</pre> | [
"Parses",
"a",
"64",
"-",
"bit",
"long",
"value",
"from",
"the",
"stream",
"."
] | 89e4f5af28602101dab7b498995018871616357b | https://github.com/alipay/sofa-hessian/blob/89e4f5af28602101dab7b498995018871616357b/src/main/java/com/caucho/hessian/io/HessianInput.java#L1404-L1423 | train |
alipay/sofa-hessian | src/main/java/com/caucho/hessian/io/HessianInput.java | HessianInput.parseDouble | private double parseDouble()
throws IOException
{
long b64 = read();
long b56 = read();
long b48 = read();
long b40 = read();
long b32 = read();
long b24 = read();
long b16 = read();
long b8 = read();
long bits = ((b64 << 56) +
... | java | private double parseDouble()
throws IOException
{
long b64 = read();
long b56 = read();
long b48 = read();
long b40 = read();
long b32 = read();
long b24 = read();
long b16 = read();
long b8 = read();
long bits = ((b64 << 56) +
... | [
"private",
"double",
"parseDouble",
"(",
")",
"throws",
"IOException",
"{",
"long",
"b64",
"=",
"read",
"(",
")",
";",
"long",
"b56",
"=",
"read",
"(",
")",
";",
"long",
"b48",
"=",
"read",
"(",
")",
";",
"long",
"b40",
"=",
"read",
"(",
")",
";"... | Parses a 64-bit double value from the stream.
<pre>
b64 b56 b48 b40 b32 b24 b16 b8
</pre> | [
"Parses",
"a",
"64",
"-",
"bit",
"double",
"value",
"from",
"the",
"stream",
"."
] | 89e4f5af28602101dab7b498995018871616357b | https://github.com/alipay/sofa-hessian/blob/89e4f5af28602101dab7b498995018871616357b/src/main/java/com/caucho/hessian/io/HessianInput.java#L1432-L1454 | train |
alipay/sofa-hessian | src/main/java/com/caucho/hessian/io/HessianInput.java | HessianInput.parseChar | private int parseChar()
throws IOException
{
while (_chunkLength <= 0) {
if (_isLastChunk)
return -1;
int code = read();
switch (code) {
case 's':
case 'x':
_isLastChunk = false;
... | java | private int parseChar()
throws IOException
{
while (_chunkLength <= 0) {
if (_isLastChunk)
return -1;
int code = read();
switch (code) {
case 's':
case 'x':
_isLastChunk = false;
... | [
"private",
"int",
"parseChar",
"(",
")",
"throws",
"IOException",
"{",
"while",
"(",
"_chunkLength",
"<=",
"0",
")",
"{",
"if",
"(",
"_isLastChunk",
")",
"return",
"-",
"1",
";",
"int",
"code",
"=",
"read",
"(",
")",
";",
"switch",
"(",
"code",
")",
... | Reads a character from the underlying stream. | [
"Reads",
"a",
"character",
"from",
"the",
"underlying",
"stream",
"."
] | 89e4f5af28602101dab7b498995018871616357b | https://github.com/alipay/sofa-hessian/blob/89e4f5af28602101dab7b498995018871616357b/src/main/java/com/caucho/hessian/io/HessianInput.java#L1465-L1498 | train |
alipay/sofa-hessian | src/main/java/com/caucho/hessian/io/HessianInput.java | HessianInput.parseUTF8Char | private int parseUTF8Char()
throws IOException
{
int ch = read();
if (ch < 0x80)
return ch;
else if ((ch & 0xe0) == 0xc0) {
int ch1 = read();
int v = ((ch & 0x1f) << 6) + (ch1 & 0x3f);
return v;
}
else if ((ch & 0xf0) ... | java | private int parseUTF8Char()
throws IOException
{
int ch = read();
if (ch < 0x80)
return ch;
else if ((ch & 0xe0) == 0xc0) {
int ch1 = read();
int v = ((ch & 0x1f) << 6) + (ch1 & 0x3f);
return v;
}
else if ((ch & 0xf0) ... | [
"private",
"int",
"parseUTF8Char",
"(",
")",
"throws",
"IOException",
"{",
"int",
"ch",
"=",
"read",
"(",
")",
";",
"if",
"(",
"ch",
"<",
"0x80",
")",
"return",
"ch",
";",
"else",
"if",
"(",
"(",
"ch",
"&",
"0xe0",
")",
"==",
"0xc0",
")",
"{",
... | Parses a single UTF8 character. | [
"Parses",
"a",
"single",
"UTF8",
"character",
"."
] | 89e4f5af28602101dab7b498995018871616357b | https://github.com/alipay/sofa-hessian/blob/89e4f5af28602101dab7b498995018871616357b/src/main/java/com/caucho/hessian/io/HessianInput.java#L1503-L1525 | train |
alipay/sofa-hessian | src/main/java/com/caucho/hessian/io/HessianInput.java | HessianInput.parseByte | private int parseByte()
throws IOException
{
while (_chunkLength <= 0) {
if (_isLastChunk) {
return -1;
}
int code = read();
switch (code) {
case 'b':
_isLastChunk = false;
_chu... | java | private int parseByte()
throws IOException
{
while (_chunkLength <= 0) {
if (_isLastChunk) {
return -1;
}
int code = read();
switch (code) {
case 'b':
_isLastChunk = false;
_chu... | [
"private",
"int",
"parseByte",
"(",
")",
"throws",
"IOException",
"{",
"while",
"(",
"_chunkLength",
"<=",
"0",
")",
"{",
"if",
"(",
"_isLastChunk",
")",
"{",
"return",
"-",
"1",
";",
"}",
"int",
"code",
"=",
"read",
"(",
")",
";",
"switch",
"(",
"... | Reads a byte from the underlying stream. | [
"Reads",
"a",
"byte",
"from",
"the",
"underlying",
"stream",
"."
] | 89e4f5af28602101dab7b498995018871616357b | https://github.com/alipay/sofa-hessian/blob/89e4f5af28602101dab7b498995018871616357b/src/main/java/com/caucho/hessian/io/HessianInput.java#L1530-L1561 | train |
alipay/sofa-hessian | src/main/java/com/caucho/hessian/io/HessianInput.java | HessianInput.readInputStream | public InputStream readInputStream()
throws IOException
{
int tag = read();
switch (tag) {
case 'N':
return null;
case 'B':
case 'b':
_isLastChunk = tag == 'B';
_chunkLength = (read() << 8) + read();
... | java | public InputStream readInputStream()
throws IOException
{
int tag = read();
switch (tag) {
case 'N':
return null;
case 'B':
case 'b':
_isLastChunk = tag == 'B';
_chunkLength = (read() << 8) + read();
... | [
"public",
"InputStream",
"readInputStream",
"(",
")",
"throws",
"IOException",
"{",
"int",
"tag",
"=",
"read",
"(",
")",
";",
"switch",
"(",
"tag",
")",
"{",
"case",
"'",
"'",
":",
"return",
"null",
";",
"case",
"'",
"'",
":",
"case",
"'",
"'",
":"... | Reads bytes based on an input stream. | [
"Reads",
"bytes",
"based",
"on",
"an",
"input",
"stream",
"."
] | 89e4f5af28602101dab7b498995018871616357b | https://github.com/alipay/sofa-hessian/blob/89e4f5af28602101dab7b498995018871616357b/src/main/java/com/caucho/hessian/io/HessianInput.java#L1566-L1623 | train |
alipay/sofa-hessian | src/main/java/com/caucho/hessian/io/HessianInput.java | HessianInput.read | int read(byte[] buffer, int offset, int length)
throws IOException
{
int readLength = 0;
while (length > 0) {
while (_chunkLength <= 0) {
if (_isLastChunk)
return readLength == 0 ? -1 : readLength;
int code = read();
... | java | int read(byte[] buffer, int offset, int length)
throws IOException
{
int readLength = 0;
while (length > 0) {
while (_chunkLength <= 0) {
if (_isLastChunk)
return readLength == 0 ? -1 : readLength;
int code = read();
... | [
"int",
"read",
"(",
"byte",
"[",
"]",
"buffer",
",",
"int",
"offset",
",",
"int",
"length",
")",
"throws",
"IOException",
"{",
"int",
"readLength",
"=",
"0",
";",
"while",
"(",
"length",
">",
"0",
")",
"{",
"while",
"(",
"_chunkLength",
"<=",
"0",
... | Reads bytes from the underlying stream. | [
"Reads",
"bytes",
"from",
"the",
"underlying",
"stream",
"."
] | 89e4f5af28602101dab7b498995018871616357b | https://github.com/alipay/sofa-hessian/blob/89e4f5af28602101dab7b498995018871616357b/src/main/java/com/caucho/hessian/io/HessianInput.java#L1628-L1670 | train |
alipay/sofa-hessian | src/main/java/com/caucho/hessian/mux/MuxOutputStream.java | MuxOutputStream.getOutputStream | protected OutputStream getOutputStream()
throws IOException
{
if (os == null && server != null)
os = server.writeChannel(channel);
return os;
} | java | protected OutputStream getOutputStream()
throws IOException
{
if (os == null && server != null)
os = server.writeChannel(channel);
return os;
} | [
"protected",
"OutputStream",
"getOutputStream",
"(",
")",
"throws",
"IOException",
"{",
"if",
"(",
"os",
"==",
"null",
"&&",
"server",
"!=",
"null",
")",
"os",
"=",
"server",
".",
"writeChannel",
"(",
"channel",
")",
";",
"return",
"os",
";",
"}"
] | Gets the raw output stream. Clients will normally not call
this. | [
"Gets",
"the",
"raw",
"output",
"stream",
".",
"Clients",
"will",
"normally",
"not",
"call",
"this",
"."
] | 89e4f5af28602101dab7b498995018871616357b | https://github.com/alipay/sofa-hessian/blob/89e4f5af28602101dab7b498995018871616357b/src/main/java/com/caucho/hessian/mux/MuxOutputStream.java#L84-L91 | train |
alipay/sofa-hessian | src/main/java/com/caucho/hessian/mux/MuxOutputStream.java | MuxOutputStream.write | public void write(int ch)
throws IOException
{
OutputStream os = getOutputStream();
os.write('D');
os.write(0);
os.write(1);
os.write(ch);
} | java | public void write(int ch)
throws IOException
{
OutputStream os = getOutputStream();
os.write('D');
os.write(0);
os.write(1);
os.write(ch);
} | [
"public",
"void",
"write",
"(",
"int",
"ch",
")",
"throws",
"IOException",
"{",
"OutputStream",
"os",
"=",
"getOutputStream",
"(",
")",
";",
"os",
".",
"write",
"(",
"'",
"'",
")",
";",
"os",
".",
"write",
"(",
"0",
")",
";",
"os",
".",
"write",
... | Writes a data byte to the output stream. | [
"Writes",
"a",
"data",
"byte",
"to",
"the",
"output",
"stream",
"."
] | 89e4f5af28602101dab7b498995018871616357b | https://github.com/alipay/sofa-hessian/blob/89e4f5af28602101dab7b498995018871616357b/src/main/java/com/caucho/hessian/mux/MuxOutputStream.java#L113-L122 | train |
alipay/sofa-hessian | src/main/java/com/caucho/hessian/mux/MuxOutputStream.java | MuxOutputStream.write | public void write(byte[] buffer, int offset, int length)
throws IOException
{
OutputStream os = getOutputStream();
for (; length > 0x8000; length -= 0x8000) {
os.write('D');
os.write(0x80);
os.write(0x00);
os.write(buffer, offset, 0x8000);
... | java | public void write(byte[] buffer, int offset, int length)
throws IOException
{
OutputStream os = getOutputStream();
for (; length > 0x8000; length -= 0x8000) {
os.write('D');
os.write(0x80);
os.write(0x00);
os.write(buffer, offset, 0x8000);
... | [
"public",
"void",
"write",
"(",
"byte",
"[",
"]",
"buffer",
",",
"int",
"offset",
",",
"int",
"length",
")",
"throws",
"IOException",
"{",
"OutputStream",
"os",
"=",
"getOutputStream",
"(",
")",
";",
"for",
"(",
";",
"length",
">",
"0x8000",
";",
"leng... | Writes data to the output stream. | [
"Writes",
"data",
"to",
"the",
"output",
"stream",
"."
] | 89e4f5af28602101dab7b498995018871616357b | https://github.com/alipay/sofa-hessian/blob/89e4f5af28602101dab7b498995018871616357b/src/main/java/com/caucho/hessian/mux/MuxOutputStream.java#L127-L145 | train |
alipay/sofa-hessian | src/main/java/com/caucho/hessian/mux/MuxOutputStream.java | MuxOutputStream.close | public void close()
throws IOException
{
if (server != null) {
OutputStream os = getOutputStream();
this.os = null;
MuxServer server = this.server;
this.server = null;
server.close(channel);
}
} | java | public void close()
throws IOException
{
if (server != null) {
OutputStream os = getOutputStream();
this.os = null;
MuxServer server = this.server;
this.server = null;
server.close(channel);
}
} | [
"public",
"void",
"close",
"(",
")",
"throws",
"IOException",
"{",
"if",
"(",
"server",
"!=",
"null",
")",
"{",
"OutputStream",
"os",
"=",
"getOutputStream",
"(",
")",
";",
"this",
".",
"os",
"=",
"null",
";",
"MuxServer",
"server",
"=",
"this",
".",
... | Complete writing to the stream, closing the channel. | [
"Complete",
"writing",
"to",
"the",
"stream",
"closing",
"the",
"channel",
"."
] | 89e4f5af28602101dab7b498995018871616357b | https://github.com/alipay/sofa-hessian/blob/89e4f5af28602101dab7b498995018871616357b/src/main/java/com/caucho/hessian/mux/MuxOutputStream.java#L176-L188 | train |
alipay/sofa-hessian | src/main/java/com/caucho/hessian/mux/MuxOutputStream.java | MuxOutputStream.writeUTF | protected void writeUTF(int code, String string)
throws IOException
{
OutputStream os = getOutputStream();
os.write(code);
int charLength = string.length();
int length = 0;
for (int i = 0; i < charLength; i++) {
char ch = string.charAt(i);
... | java | protected void writeUTF(int code, String string)
throws IOException
{
OutputStream os = getOutputStream();
os.write(code);
int charLength = string.length();
int length = 0;
for (int i = 0; i < charLength; i++) {
char ch = string.charAt(i);
... | [
"protected",
"void",
"writeUTF",
"(",
"int",
"code",
",",
"String",
"string",
")",
"throws",
"IOException",
"{",
"OutputStream",
"os",
"=",
"getOutputStream",
"(",
")",
";",
"os",
".",
"write",
"(",
"code",
")",
";",
"int",
"charLength",
"=",
"string",
"... | Writes a UTF-8 string.
@param code the HMUX code identifying the string
@param string the string to write | [
"Writes",
"a",
"UTF",
"-",
"8",
"string",
"."
] | 89e4f5af28602101dab7b498995018871616357b | https://github.com/alipay/sofa-hessian/blob/89e4f5af28602101dab7b498995018871616357b/src/main/java/com/caucho/hessian/mux/MuxOutputStream.java#L196-L235 | train |
alipay/sofa-hessian | src/main/java/com/caucho/hessian/io/AbstractHessianInput.java | AbstractHessianInput.readToOutputStream | public boolean readToOutputStream(OutputStream os)
throws IOException
{
InputStream is = readInputStream();
if (is == null)
return false;
if (_buffer == null)
_buffer = new byte[256];
try {
int len;
while ((len = is.read(_bu... | java | public boolean readToOutputStream(OutputStream os)
throws IOException
{
InputStream is = readInputStream();
if (is == null)
return false;
if (_buffer == null)
_buffer = new byte[256];
try {
int len;
while ((len = is.read(_bu... | [
"public",
"boolean",
"readToOutputStream",
"(",
"OutputStream",
"os",
")",
"throws",
"IOException",
"{",
"InputStream",
"is",
"=",
"readInputStream",
"(",
")",
";",
"if",
"(",
"is",
"==",
"null",
")",
"return",
"false",
";",
"if",
"(",
"_buffer",
"==",
"nu... | Reads data to an output stream.
<pre>
b b16 b8 non-final binary chunk
B b16 b8 final binary chunk
</pre> | [
"Reads",
"data",
"to",
"an",
"output",
"stream",
"."
] | 89e4f5af28602101dab7b498995018871616357b | https://github.com/alipay/sofa-hessian/blob/89e4f5af28602101dab7b498995018871616357b/src/main/java/com/caucho/hessian/io/AbstractHessianInput.java#L344-L366 | train |
alipay/sofa-hessian | src/main/java/com/caucho/hessian/io/CalendarSerializer.java | CalendarSerializer.writeReplace | @Override
public Object writeReplace(Object obj)
{
Calendar cal = (Calendar) obj;
return new CalendarHandle(cal.getClass(), cal.getTimeInMillis());
} | java | @Override
public Object writeReplace(Object obj)
{
Calendar cal = (Calendar) obj;
return new CalendarHandle(cal.getClass(), cal.getTimeInMillis());
} | [
"@",
"Override",
"public",
"Object",
"writeReplace",
"(",
"Object",
"obj",
")",
"{",
"Calendar",
"cal",
"=",
"(",
"Calendar",
")",
"obj",
";",
"return",
"new",
"CalendarHandle",
"(",
"cal",
".",
"getClass",
"(",
")",
",",
"cal",
".",
"getTimeInMillis",
"... | java.util.Calendar serializes to com.caucho.hessian.io.CalendarHandle | [
"java",
".",
"util",
".",
"Calendar",
"serializes",
"to",
"com",
".",
"caucho",
".",
"hessian",
".",
"io",
".",
"CalendarHandle"
] | 89e4f5af28602101dab7b498995018871616357b | https://github.com/alipay/sofa-hessian/blob/89e4f5af28602101dab7b498995018871616357b/src/main/java/com/caucho/hessian/io/CalendarSerializer.java#L63-L69 | train |
alipay/sofa-hessian | src/main/java/com/caucho/services/server/AbstractSkeleton.java | AbstractSkeleton.mangleName | public static String mangleName(Method method, boolean isFull)
{
StringBuffer sb = new StringBuffer();
sb.append(method.getName());
Class[] params = method.getParameterTypes();
for (int i = 0; i < params.length; i++) {
sb.append('_');
sb.append(mangleClass(p... | java | public static String mangleName(Method method, boolean isFull)
{
StringBuffer sb = new StringBuffer();
sb.append(method.getName());
Class[] params = method.getParameterTypes();
for (int i = 0; i < params.length; i++) {
sb.append('_');
sb.append(mangleClass(p... | [
"public",
"static",
"String",
"mangleName",
"(",
"Method",
"method",
",",
"boolean",
"isFull",
")",
"{",
"StringBuffer",
"sb",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"sb",
".",
"append",
"(",
"method",
".",
"getName",
"(",
")",
")",
";",
"Class",
"... | Creates a unique mangled method name based on the method name and
the method parameters.
@param method the method to mangle
@param isFull if true, mangle the full classname
@return a mangled string. | [
"Creates",
"a",
"unique",
"mangled",
"method",
"name",
"based",
"on",
"the",
"method",
"name",
"and",
"the",
"method",
"parameters",
"."
] | 89e4f5af28602101dab7b498995018871616357b | https://github.com/alipay/sofa-hessian/blob/89e4f5af28602101dab7b498995018871616357b/src/main/java/com/caucho/services/server/AbstractSkeleton.java#L155-L168 | train |
alipay/sofa-hessian | src/main/java/com/caucho/services/server/AbstractSkeleton.java | AbstractSkeleton.mangleClass | public static String mangleClass(Class cl, boolean isFull)
{
String name = cl.getName();
if (name.equals("boolean") || name.equals("java.lang.Boolean"))
return "boolean";
else if (name.equals("int") || name.equals("java.lang.Integer")
|| name.equals("short") || name.... | java | public static String mangleClass(Class cl, boolean isFull)
{
String name = cl.getName();
if (name.equals("boolean") || name.equals("java.lang.Boolean"))
return "boolean";
else if (name.equals("int") || name.equals("java.lang.Integer")
|| name.equals("short") || name.... | [
"public",
"static",
"String",
"mangleClass",
"(",
"Class",
"cl",
",",
"boolean",
"isFull",
")",
"{",
"String",
"name",
"=",
"cl",
".",
"getName",
"(",
")",
";",
"if",
"(",
"name",
".",
"equals",
"(",
"\"boolean\"",
")",
"||",
"name",
".",
"equals",
"... | Mangles a classname. | [
"Mangles",
"a",
"classname",
"."
] | 89e4f5af28602101dab7b498995018871616357b | https://github.com/alipay/sofa-hessian/blob/89e4f5af28602101dab7b498995018871616357b/src/main/java/com/caucho/services/server/AbstractSkeleton.java#L173-L215 | train |
alipay/sofa-hessian | src/main/java/com/caucho/hessian/client/HessianURLConnection.java | HessianURLConnection.addHeader | @Override
public void addHeader(String key, String value)
{
_conn.setRequestProperty(key, value);
} | java | @Override
public void addHeader(String key, String value)
{
_conn.setRequestProperty(key, value);
} | [
"@",
"Override",
"public",
"void",
"addHeader",
"(",
"String",
"key",
",",
"String",
"value",
")",
"{",
"_conn",
".",
"setRequestProperty",
"(",
"key",
",",
"value",
")",
";",
"}"
] | Adds a HTTP header. | [
"Adds",
"a",
"HTTP",
"header",
"."
] | 89e4f5af28602101dab7b498995018871616357b | https://github.com/alipay/sofa-hessian/blob/89e4f5af28602101dab7b498995018871616357b/src/main/java/com/caucho/hessian/client/HessianURLConnection.java#L85-L89 | train |
alipay/sofa-hessian | src/main/java/com/caucho/hessian/client/HessianURLConnection.java | HessianURLConnection.sendRequest | public void sendRequest()
throws IOException
{
if (_conn instanceof HttpURLConnection) {
HttpURLConnection httpConn = (HttpURLConnection) _conn;
_statusCode = 500;
try {
_statusCode = httpConn.getResponseCode();
} catch (Exception e) ... | java | public void sendRequest()
throws IOException
{
if (_conn instanceof HttpURLConnection) {
HttpURLConnection httpConn = (HttpURLConnection) _conn;
_statusCode = 500;
try {
_statusCode = httpConn.getResponseCode();
} catch (Exception e) ... | [
"public",
"void",
"sendRequest",
"(",
")",
"throws",
"IOException",
"{",
"if",
"(",
"_conn",
"instanceof",
"HttpURLConnection",
")",
"{",
"HttpURLConnection",
"httpConn",
"=",
"(",
"HttpURLConnection",
")",
"_conn",
";",
"_statusCode",
"=",
"500",
";",
"try",
... | Sends the request | [
"Sends",
"the",
"request"
] | 89e4f5af28602101dab7b498995018871616357b | https://github.com/alipay/sofa-hessian/blob/89e4f5af28602101dab7b498995018871616357b/src/main/java/com/caucho/hessian/client/HessianURLConnection.java#L103-L156 | train |
alipay/sofa-hessian | src/main/java/com/caucho/hessian/client/HessianURLConnection.java | HessianURLConnection.destroy | @Override
public void destroy()
{
close();
URLConnection conn = _conn;
_conn = null;
if (conn instanceof HttpURLConnection)
((HttpURLConnection) conn).disconnect();
} | java | @Override
public void destroy()
{
close();
URLConnection conn = _conn;
_conn = null;
if (conn instanceof HttpURLConnection)
((HttpURLConnection) conn).disconnect();
} | [
"@",
"Override",
"public",
"void",
"destroy",
"(",
")",
"{",
"close",
"(",
")",
";",
"URLConnection",
"conn",
"=",
"_conn",
";",
"_conn",
"=",
"null",
";",
"if",
"(",
"conn",
"instanceof",
"HttpURLConnection",
")",
"(",
"(",
"HttpURLConnection",
")",
"co... | Disconnect the connection | [
"Disconnect",
"the",
"connection"
] | 89e4f5af28602101dab7b498995018871616357b | https://github.com/alipay/sofa-hessian/blob/89e4f5af28602101dab7b498995018871616357b/src/main/java/com/caucho/hessian/client/HessianURLConnection.java#L207-L217 | train |
alipay/sofa-hessian | src/main/java/com/caucho/hessian/mux/MuxInputStream.java | MuxInputStream.getInputStream | protected InputStream getInputStream()
throws IOException
{
if (is == null && server != null)
is = server.readChannel(channel);
return is;
} | java | protected InputStream getInputStream()
throws IOException
{
if (is == null && server != null)
is = server.readChannel(channel);
return is;
} | [
"protected",
"InputStream",
"getInputStream",
"(",
")",
"throws",
"IOException",
"{",
"if",
"(",
"is",
"==",
"null",
"&&",
"server",
"!=",
"null",
")",
"is",
"=",
"server",
".",
"readChannel",
"(",
"channel",
")",
";",
"return",
"is",
";",
"}"
] | Gets the raw input stream. Clients will normally not call
this. | [
"Gets",
"the",
"raw",
"input",
"stream",
".",
"Clients",
"will",
"normally",
"not",
"call",
"this",
"."
] | 89e4f5af28602101dab7b498995018871616357b | https://github.com/alipay/sofa-hessian/blob/89e4f5af28602101dab7b498995018871616357b/src/main/java/com/caucho/hessian/mux/MuxInputStream.java#L91-L98 | train |
alipay/sofa-hessian | src/main/java/com/caucho/hessian/mux/MuxInputStream.java | MuxInputStream.skipToEnd | private void skipToEnd()
throws IOException
{
InputStream is = getInputStream();
if (is == null)
return;
if (chunkLength > 0)
is.skip(chunkLength);
for (int tag = is.read(); tag >= 0; tag = is.read()) {
switch (tag) {
cas... | java | private void skipToEnd()
throws IOException
{
InputStream is = getInputStream();
if (is == null)
return;
if (chunkLength > 0)
is.skip(chunkLength);
for (int tag = is.read(); tag >= 0; tag = is.read()) {
switch (tag) {
cas... | [
"private",
"void",
"skipToEnd",
"(",
")",
"throws",
"IOException",
"{",
"InputStream",
"is",
"=",
"getInputStream",
"(",
")",
";",
"if",
"(",
"is",
"==",
"null",
")",
"return",
";",
"if",
"(",
"chunkLength",
">",
"0",
")",
"is",
".",
"skip",
"(",
"ch... | Skips data until the end of the channel. | [
"Skips",
"data",
"until",
"the",
"end",
"of",
"the",
"channel",
"."
] | 89e4f5af28602101dab7b498995018871616357b | https://github.com/alipay/sofa-hessian/blob/89e4f5af28602101dab7b498995018871616357b/src/main/java/com/caucho/hessian/mux/MuxInputStream.java#L150-L190 | train |
alipay/sofa-hessian | src/main/java/com/caucho/hessian/mux/MuxInputStream.java | MuxInputStream.readToData | void readToData(boolean returnOnYield)
throws IOException
{
InputStream is = getInputStream();
if (is == null)
return;
for (int tag = is.read(); tag >= 0; tag = is.read()) {
switch (tag) {
case 'Y':
server.freeReadLock();
... | java | void readToData(boolean returnOnYield)
throws IOException
{
InputStream is = getInputStream();
if (is == null)
return;
for (int tag = is.read(); tag >= 0; tag = is.read()) {
switch (tag) {
case 'Y':
server.freeReadLock();
... | [
"void",
"readToData",
"(",
"boolean",
"returnOnYield",
")",
"throws",
"IOException",
"{",
"InputStream",
"is",
"=",
"getInputStream",
"(",
")",
";",
"if",
"(",
"is",
"==",
"null",
")",
"return",
";",
"for",
"(",
"int",
"tag",
"=",
"is",
".",
"read",
"(... | Reads tags, until getting data. | [
"Reads",
"tags",
"until",
"getting",
"data",
"."
] | 89e4f5af28602101dab7b498995018871616357b | https://github.com/alipay/sofa-hessian/blob/89e4f5af28602101dab7b498995018871616357b/src/main/java/com/caucho/hessian/mux/MuxInputStream.java#L195-L231 | train |
alipay/sofa-hessian | src/main/java/com/caucho/hessian/mux/MuxInputStream.java | MuxInputStream.readTag | protected void readTag(int tag)
throws IOException
{
int length = (is.read() << 8) + is.read();
is.skip(length);
} | java | protected void readTag(int tag)
throws IOException
{
int length = (is.read() << 8) + is.read();
is.skip(length);
} | [
"protected",
"void",
"readTag",
"(",
"int",
"tag",
")",
"throws",
"IOException",
"{",
"int",
"length",
"=",
"(",
"is",
".",
"read",
"(",
")",
"<<",
"8",
")",
"+",
"is",
".",
"read",
"(",
")",
";",
"is",
".",
"skip",
"(",
"length",
")",
";",
"}"... | Subclasses will extend this to read values. | [
"Subclasses",
"will",
"extend",
"this",
"to",
"read",
"values",
"."
] | 89e4f5af28602101dab7b498995018871616357b | https://github.com/alipay/sofa-hessian/blob/89e4f5af28602101dab7b498995018871616357b/src/main/java/com/caucho/hessian/mux/MuxInputStream.java#L236-L241 | train |
alipay/sofa-hessian | src/main/java/com/caucho/hessian/mux/MuxInputStream.java | MuxInputStream.readUTF | protected String readUTF()
throws IOException
{
int len = (is.read() << 8) + is.read();
StringBuffer sb = new StringBuffer();
while (len > 0) {
int d1 = is.read();
if (d1 < 0)
return sb.toString();
else if (d1 < 0x80) {
... | java | protected String readUTF()
throws IOException
{
int len = (is.read() << 8) + is.read();
StringBuffer sb = new StringBuffer();
while (len > 0) {
int d1 = is.read();
if (d1 < 0)
return sb.toString();
else if (d1 < 0x80) {
... | [
"protected",
"String",
"readUTF",
"(",
")",
"throws",
"IOException",
"{",
"int",
"len",
"=",
"(",
"is",
".",
"read",
"(",
")",
"<<",
"8",
")",
"+",
"is",
".",
"read",
"(",
")",
";",
"StringBuffer",
"sb",
"=",
"new",
"StringBuffer",
"(",
")",
";",
... | Reads a UTF-8 string.
@return the utf-8 encoded string | [
"Reads",
"a",
"UTF",
"-",
"8",
"string",
"."
] | 89e4f5af28602101dab7b498995018871616357b | https://github.com/alipay/sofa-hessian/blob/89e4f5af28602101dab7b498995018871616357b/src/main/java/com/caucho/hessian/mux/MuxInputStream.java#L248-L279 | train |
alipay/sofa-hessian | src/main/java/com/caucho/hessian/client/HessianProxyFactory.java | HessianProxyFactory.getObjectInstance | public Object getObjectInstance(Object obj, Name name,
Context nameCtx, Hashtable<?, ?> environment)
throws Exception
{
Reference ref = (Reference) obj;
String api = null;
String url = null;
for (int i = 0; i < ref.size(); i++) {
... | java | public Object getObjectInstance(Object obj, Name name,
Context nameCtx, Hashtable<?, ?> environment)
throws Exception
{
Reference ref = (Reference) obj;
String api = null;
String url = null;
for (int i = 0; i < ref.size(); i++) {
... | [
"public",
"Object",
"getObjectInstance",
"(",
"Object",
"obj",
",",
"Name",
"name",
",",
"Context",
"nameCtx",
",",
"Hashtable",
"<",
"?",
",",
"?",
">",
"environment",
")",
"throws",
"Exception",
"{",
"Reference",
"ref",
"=",
"(",
"Reference",
")",
"obj",... | JNDI object factory so the proxy can be used as a resource. | [
"JNDI",
"object",
"factory",
"so",
"the",
"proxy",
"can",
"be",
"used",
"as",
"a",
"resource",
"."
] | 89e4f5af28602101dab7b498995018871616357b | https://github.com/alipay/sofa-hessian/blob/89e4f5af28602101dab7b498995018871616357b/src/main/java/com/caucho/hessian/client/HessianProxyFactory.java#L519-L553 | train |
alipay/sofa-hessian | src/main/java/com/caucho/hessian/client/HessianProxyFactory.java | HessianProxyFactory.base64 | private String base64(String value)
{
StringBuffer cb = new StringBuffer();
int i = 0;
for (i = 0; i + 2 < value.length(); i += 3) {
long chunk = (int) value.charAt(i);
chunk = (chunk << 8) + (int) value.charAt(i + 1);
chunk = (chunk << 8) + (int) value.c... | java | private String base64(String value)
{
StringBuffer cb = new StringBuffer();
int i = 0;
for (i = 0; i + 2 < value.length(); i += 3) {
long chunk = (int) value.charAt(i);
chunk = (chunk << 8) + (int) value.charAt(i + 1);
chunk = (chunk << 8) + (int) value.c... | [
"private",
"String",
"base64",
"(",
"String",
"value",
")",
"{",
"StringBuffer",
"cb",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"int",
"i",
"=",
"0",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"+",
"2",
"<",
"value",
".",
"length",
"(",
")",
"... | Creates the Base64 value. | [
"Creates",
"the",
"Base64",
"value",
"."
] | 89e4f5af28602101dab7b498995018871616357b | https://github.com/alipay/sofa-hessian/blob/89e4f5af28602101dab7b498995018871616357b/src/main/java/com/caucho/hessian/client/HessianProxyFactory.java#L558-L595 | train |
alipay/sofa-hessian | src/main/java/com/caucho/hessian/io/AbstractStreamSerializer.java | AbstractStreamSerializer.writeObject | @Override
public void writeObject(Object obj, AbstractHessianOutput out)
throws IOException
{
if (out.addRef(obj)) {
return;
}
int ref = out.writeObjectBegin(getClassName(obj));
if (ref < -1) {
out.writeString("value");
InputStream i... | java | @Override
public void writeObject(Object obj, AbstractHessianOutput out)
throws IOException
{
if (out.addRef(obj)) {
return;
}
int ref = out.writeObjectBegin(getClassName(obj));
if (ref < -1) {
out.writeString("value");
InputStream i... | [
"@",
"Override",
"public",
"void",
"writeObject",
"(",
"Object",
"obj",
",",
"AbstractHessianOutput",
"out",
")",
"throws",
"IOException",
"{",
"if",
"(",
"out",
".",
"addRef",
"(",
"obj",
")",
")",
"{",
"return",
";",
"}",
"int",
"ref",
"=",
"out",
".... | Writes the object to the output stream. | [
"Writes",
"the",
"object",
"to",
"the",
"output",
"stream",
"."
] | 89e4f5af28602101dab7b498995018871616357b | https://github.com/alipay/sofa-hessian/blob/89e4f5af28602101dab7b498995018871616357b/src/main/java/com/caucho/hessian/io/AbstractStreamSerializer.java#L63-L122 | train |
alipay/sofa-hessian | src/main/java/com/caucho/hessian/io/HessianSerializerInput.java | HessianSerializerInput.readObjectImpl | protected Object readObjectImpl(Class cl)
throws IOException
{
try {
Object obj = cl.newInstance();
if (_refs == null)
_refs = new ArrayList();
_refs.add(obj);
HashMap fieldMap = getFieldMap(cl);
int code = read();
... | java | protected Object readObjectImpl(Class cl)
throws IOException
{
try {
Object obj = cl.newInstance();
if (_refs == null)
_refs = new ArrayList();
_refs.add(obj);
HashMap fieldMap = getFieldMap(cl);
int code = read();
... | [
"protected",
"Object",
"readObjectImpl",
"(",
"Class",
"cl",
")",
"throws",
"IOException",
"{",
"try",
"{",
"Object",
"obj",
"=",
"cl",
".",
"newInstance",
"(",
")",
";",
"if",
"(",
"_refs",
"==",
"null",
")",
"_refs",
"=",
"new",
"ArrayList",
"(",
")"... | Reads an object from the input stream. cl is known not to be
a Map. | [
"Reads",
"an",
"object",
"from",
"the",
"input",
"stream",
".",
"cl",
"is",
"known",
"not",
"to",
"be",
"a",
"Map",
"."
] | 89e4f5af28602101dab7b498995018871616357b | https://github.com/alipay/sofa-hessian/blob/89e4f5af28602101dab7b498995018871616357b/src/main/java/com/caucho/hessian/io/HessianSerializerInput.java#L112-L157 | train |
alipay/sofa-hessian | src/main/java/com/caucho/hessian/io/SerializerFactory.java | SerializerFactory.setSendCollectionType | public void setSendCollectionType(boolean isSendType) {
if (_collectionSerializer == null)
_collectionSerializer = new CollectionSerializer();
_collectionSerializer.setSendJavaType(isSendType);
if (_mapSerializer == null)
_mapSerializer = new MapSerializer();
_... | java | public void setSendCollectionType(boolean isSendType) {
if (_collectionSerializer == null)
_collectionSerializer = new CollectionSerializer();
_collectionSerializer.setSendJavaType(isSendType);
if (_mapSerializer == null)
_mapSerializer = new MapSerializer();
_... | [
"public",
"void",
"setSendCollectionType",
"(",
"boolean",
"isSendType",
")",
"{",
"if",
"(",
"_collectionSerializer",
"==",
"null",
")",
"_collectionSerializer",
"=",
"new",
"CollectionSerializer",
"(",
")",
";",
"_collectionSerializer",
".",
"setSendJavaType",
"(",
... | Set true if the collection serializer should send the java type. | [
"Set",
"true",
"if",
"the",
"collection",
"serializer",
"should",
"send",
"the",
"java",
"type",
"."
] | 89e4f5af28602101dab7b498995018871616357b | https://github.com/alipay/sofa-hessian/blob/89e4f5af28602101dab7b498995018871616357b/src/main/java/com/caucho/hessian/io/SerializerFactory.java#L176-L186 | train |
alipay/sofa-hessian | src/main/java/com/caucho/hessian/io/SerializerFactory.java | SerializerFactory.readList | public Object readList(AbstractHessianInput in, int length, String type)
throws HessianProtocolException, IOException {
Deserializer deserializer = getDeserializer(type);
if (deserializer != null)
return deserializer.readList(in, length);
else
return new Collecti... | java | public Object readList(AbstractHessianInput in, int length, String type)
throws HessianProtocolException, IOException {
Deserializer deserializer = getDeserializer(type);
if (deserializer != null)
return deserializer.readList(in, length);
else
return new Collecti... | [
"public",
"Object",
"readList",
"(",
"AbstractHessianInput",
"in",
",",
"int",
"length",
",",
"String",
"type",
")",
"throws",
"HessianProtocolException",
",",
"IOException",
"{",
"Deserializer",
"deserializer",
"=",
"getDeserializer",
"(",
"type",
")",
";",
"if",... | Reads the object as a list. | [
"Reads",
"the",
"object",
"as",
"a",
"list",
"."
] | 89e4f5af28602101dab7b498995018871616357b | https://github.com/alipay/sofa-hessian/blob/89e4f5af28602101dab7b498995018871616357b/src/main/java/com/caucho/hessian/io/SerializerFactory.java#L536-L544 | train |
alipay/sofa-hessian | src/main/java/com/caucho/hessian/io/AbstractStreamDeserializer.java | AbstractStreamDeserializer.readMap | @Override
public Object readMap(AbstractHessianInput in)
throws IOException
{
Object value = null;
while (!in.isEnd()) {
String key = in.readString();
if (key.equals("value"))
value = readStreamValue(in);
else
in.readO... | java | @Override
public Object readMap(AbstractHessianInput in)
throws IOException
{
Object value = null;
while (!in.isEnd()) {
String key = in.readString();
if (key.equals("value"))
value = readStreamValue(in);
else
in.readO... | [
"@",
"Override",
"public",
"Object",
"readMap",
"(",
"AbstractHessianInput",
"in",
")",
"throws",
"IOException",
"{",
"Object",
"value",
"=",
"null",
";",
"while",
"(",
"!",
"in",
".",
"isEnd",
"(",
")",
")",
"{",
"String",
"key",
"=",
"in",
".",
"read... | Reads the Hessian 1.0 style map. | [
"Reads",
"the",
"Hessian",
"1",
".",
"0",
"style",
"map",
"."
] | 89e4f5af28602101dab7b498995018871616357b | https://github.com/alipay/sofa-hessian/blob/89e4f5af28602101dab7b498995018871616357b/src/main/java/com/caucho/hessian/io/AbstractStreamDeserializer.java#L62-L80 | train |
alipay/sofa-hessian | src/main/java/com/caucho/hessian/server/HessianServlet.java | HessianServlet.service | public void service(ServletRequest request, ServletResponse response)
throws IOException, ServletException
{
HttpServletRequest req = (HttpServletRequest) request;
HttpServletResponse res = (HttpServletResponse) response;
if (!req.getMethod().equals("POST")) {
res.setSta... | java | public void service(ServletRequest request, ServletResponse response)
throws IOException, ServletException
{
HttpServletRequest req = (HttpServletRequest) request;
HttpServletResponse res = (HttpServletResponse) response;
if (!req.getMethod().equals("POST")) {
res.setSta... | [
"public",
"void",
"service",
"(",
"ServletRequest",
"request",
",",
"ServletResponse",
"response",
")",
"throws",
"IOException",
",",
"ServletException",
"{",
"HttpServletRequest",
"req",
"=",
"(",
"HttpServletRequest",
")",
"request",
";",
"HttpServletResponse",
"res... | Execute a request. The path-info of the request selects the bean.
Once the bean's selected, it will be applied. | [
"Execute",
"a",
"request",
".",
"The",
"path",
"-",
"info",
"of",
"the",
"request",
"selects",
"the",
"bean",
".",
"Once",
"the",
"bean",
"s",
"selected",
"it",
"will",
"be",
"applied",
"."
] | 89e4f5af28602101dab7b498995018871616357b | https://github.com/alipay/sofa-hessian/blob/89e4f5af28602101dab7b498995018871616357b/src/main/java/com/caucho/hessian/server/HessianServlet.java#L372-L413 | train |
alipay/sofa-hessian | src/main/java/com/caucho/hessian/io/HessianSerializerOutput.java | HessianSerializerOutput.writeObjectImpl | public void writeObjectImpl(Object obj)
throws IOException
{
Class cl = obj.getClass();
try {
Method method = cl.getMethod("writeReplace", new Class[0]);
Object repl = method.invoke(obj, new Object[0]);
writeObject(repl);
return;
} ca... | java | public void writeObjectImpl(Object obj)
throws IOException
{
Class cl = obj.getClass();
try {
Method method = cl.getMethod("writeReplace", new Class[0]);
Object repl = method.invoke(obj, new Object[0]);
writeObject(repl);
return;
} ca... | [
"public",
"void",
"writeObjectImpl",
"(",
"Object",
"obj",
")",
"throws",
"IOException",
"{",
"Class",
"cl",
"=",
"obj",
".",
"getClass",
"(",
")",
";",
"try",
"{",
"Method",
"method",
"=",
"cl",
".",
"getMethod",
"(",
"\"writeReplace\"",
",",
"new",
"Cl... | Applications which override this can do custom serialization.
@param object the object to write. | [
"Applications",
"which",
"override",
"this",
"can",
"do",
"custom",
"serialization",
"."
] | 89e4f5af28602101dab7b498995018871616357b | https://github.com/alipay/sofa-hessian/blob/89e4f5af28602101dab7b498995018871616357b/src/main/java/com/caucho/hessian/io/HessianSerializerOutput.java#L110-L146 | train |
alipay/sofa-hessian | src/main/java/com/caucho/hessian/util/HessianFreeList.java | HessianFreeList.checkDuplicate | public boolean checkDuplicate(T obj)
{
int top = _top.get();
for (int i = top - 1; i >= 0; i--) {
if (_freeStack.get(i) == obj)
return true;
}
return false;
} | java | public boolean checkDuplicate(T obj)
{
int top = _top.get();
for (int i = top - 1; i >= 0; i--) {
if (_freeStack.get(i) == obj)
return true;
}
return false;
} | [
"public",
"boolean",
"checkDuplicate",
"(",
"T",
"obj",
")",
"{",
"int",
"top",
"=",
"_top",
".",
"get",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"top",
"-",
"1",
";",
"i",
">=",
"0",
";",
"i",
"--",
")",
"{",
"if",
"(",
"_freeStack",
".",... | Debugging to see if the object has already been freed. | [
"Debugging",
"to",
"see",
"if",
"the",
"object",
"has",
"already",
"been",
"freed",
"."
] | 89e4f5af28602101dab7b498995018871616357b | https://github.com/alipay/sofa-hessian/blob/89e4f5af28602101dab7b498995018871616357b/src/main/java/com/caucho/hessian/util/HessianFreeList.java#L134-L144 | train |
alipay/sofa-hessian | src/main/java/com/caucho/hessian/io/ContextSerializerFactory.java | ContextSerializerFactory.getSerializer | public Serializer getSerializer(String className)
{
Serializer serializer = _serializerClassMap.get(className);
if (serializer == AbstractSerializer.NULL)
return null;
else
return serializer;
} | java | public Serializer getSerializer(String className)
{
Serializer serializer = _serializerClassMap.get(className);
if (serializer == AbstractSerializer.NULL)
return null;
else
return serializer;
} | [
"public",
"Serializer",
"getSerializer",
"(",
"String",
"className",
")",
"{",
"Serializer",
"serializer",
"=",
"_serializerClassMap",
".",
"get",
"(",
"className",
")",
";",
"if",
"(",
"serializer",
"==",
"AbstractSerializer",
".",
"NULL",
")",
"return",
"null"... | Returns the serializer for a given class. | [
"Returns",
"the",
"serializer",
"for",
"a",
"given",
"class",
"."
] | 89e4f5af28602101dab7b498995018871616357b | https://github.com/alipay/sofa-hessian/blob/89e4f5af28602101dab7b498995018871616357b/src/main/java/com/caucho/hessian/io/ContextSerializerFactory.java#L165-L173 | train |
alipay/sofa-hessian | src/main/java/com/caucho/hessian/io/ContextSerializerFactory.java | ContextSerializerFactory.getDeserializer | public Deserializer getDeserializer(String className)
{
Deserializer deserializer = _deserializerClassMap.get(className);
if (deserializer == AbstractDeserializer.NULL)
return null;
else
return deserializer;
} | java | public Deserializer getDeserializer(String className)
{
Deserializer deserializer = _deserializerClassMap.get(className);
if (deserializer == AbstractDeserializer.NULL)
return null;
else
return deserializer;
} | [
"public",
"Deserializer",
"getDeserializer",
"(",
"String",
"className",
")",
"{",
"Deserializer",
"deserializer",
"=",
"_deserializerClassMap",
".",
"get",
"(",
"className",
")",
";",
"if",
"(",
"deserializer",
"==",
"AbstractDeserializer",
".",
"NULL",
")",
"ret... | Returns the deserializer for a given class. | [
"Returns",
"the",
"deserializer",
"for",
"a",
"given",
"class",
"."
] | 89e4f5af28602101dab7b498995018871616357b | https://github.com/alipay/sofa-hessian/blob/89e4f5af28602101dab7b498995018871616357b/src/main/java/com/caucho/hessian/io/ContextSerializerFactory.java#L214-L222 | train |
alipay/sofa-hessian | src/main/java/com/caucho/hessian/io/ContextSerializerFactory.java | ContextSerializerFactory.getCustomDeserializer | public Deserializer getCustomDeserializer(Class cl)
{
Deserializer deserializer = _customDeserializerMap.get(cl.getName());
if (deserializer == AbstractDeserializer.NULL)
return null;
else if (deserializer != null)
return deserializer;
try {
Clas... | java | public Deserializer getCustomDeserializer(Class cl)
{
Deserializer deserializer = _customDeserializerMap.get(cl.getName());
if (deserializer == AbstractDeserializer.NULL)
return null;
else if (deserializer != null)
return deserializer;
try {
Clas... | [
"public",
"Deserializer",
"getCustomDeserializer",
"(",
"Class",
"cl",
")",
"{",
"Deserializer",
"deserializer",
"=",
"_customDeserializerMap",
".",
"get",
"(",
"cl",
".",
"getName",
"(",
")",
")",
";",
"if",
"(",
"deserializer",
"==",
"AbstractDeserializer",
".... | Returns a custom deserializer the class
@param cl the class of the object that needs to be deserialized.
@return a deserializer object for the deserialization. | [
"Returns",
"a",
"custom",
"deserializer",
"the",
"class"
] | 89e4f5af28602101dab7b498995018871616357b | https://github.com/alipay/sofa-hessian/blob/89e4f5af28602101dab7b498995018871616357b/src/main/java/com/caucho/hessian/io/ContextSerializerFactory.java#L231-L258 | train |
alipay/sofa-hessian | src/main/java/com/caucho/hessian/io/ContextSerializerFactory.java | ContextSerializerFactory.init | private void init()
{
if (_parent != null) {
_serializerFiles.addAll(_parent._serializerFiles);
_deserializerFiles.addAll(_parent._deserializerFiles);
_serializerClassMap.putAll(_parent._serializerClassMap);
_deserializerClassMap.putAll(_parent._deserializerC... | java | private void init()
{
if (_parent != null) {
_serializerFiles.addAll(_parent._serializerFiles);
_deserializerFiles.addAll(_parent._deserializerFiles);
_serializerClassMap.putAll(_parent._serializerClassMap);
_deserializerClassMap.putAll(_parent._deserializerC... | [
"private",
"void",
"init",
"(",
")",
"{",
"if",
"(",
"_parent",
"!=",
"null",
")",
"{",
"_serializerFiles",
".",
"addAll",
"(",
"_parent",
".",
"_serializerFiles",
")",
";",
"_deserializerFiles",
".",
"addAll",
"(",
"_parent",
".",
"_deserializerFiles",
")",... | Initialize the factory | [
"Initialize",
"the",
"factory"
] | 89e4f5af28602101dab7b498995018871616357b | https://github.com/alipay/sofa-hessian/blob/89e4f5af28602101dab7b498995018871616357b/src/main/java/com/caucho/hessian/io/ContextSerializerFactory.java#L263-L319 | train |
alipay/sofa-hessian | src/main/java/com/caucho/hessian/client/HessianProxy.java | HessianProxy.sendRequest | protected HessianConnection sendRequest(String methodName, Object[] args)
throws IOException
{
HessianConnection conn = null;
conn = _factory.getConnectionFactory().open(_url);
boolean isValid = false;
try {
addRequestHeaders(conn);
OutputStream os ... | java | protected HessianConnection sendRequest(String methodName, Object[] args)
throws IOException
{
HessianConnection conn = null;
conn = _factory.getConnectionFactory().open(_url);
boolean isValid = false;
try {
addRequestHeaders(conn);
OutputStream os ... | [
"protected",
"HessianConnection",
"sendRequest",
"(",
"String",
"methodName",
",",
"Object",
"[",
"]",
"args",
")",
"throws",
"IOException",
"{",
"HessianConnection",
"conn",
"=",
"null",
";",
"conn",
"=",
"_factory",
".",
"getConnectionFactory",
"(",
")",
".",
... | Sends the HTTP request to the Hessian connection. | [
"Sends",
"the",
"HTTP",
"request",
"to",
"the",
"Hessian",
"connection",
"."
] | 89e4f5af28602101dab7b498995018871616357b | https://github.com/alipay/sofa-hessian/blob/89e4f5af28602101dab7b498995018871616357b/src/main/java/com/caucho/hessian/client/HessianProxy.java#L262-L302 | train |
alipay/sofa-hessian | src/main/java/com/caucho/hessian/client/HessianProxy.java | HessianProxy.addRequestHeaders | protected void addRequestHeaders(HessianConnection conn)
{
conn.addHeader("Content-Type", "x-application/hessian");
conn.addHeader("Accept-Encoding", "deflate");
String basicAuth = _factory.getBasicAuth();
if (basicAuth != null)
conn.addHeader("Authorization", basicAuth... | java | protected void addRequestHeaders(HessianConnection conn)
{
conn.addHeader("Content-Type", "x-application/hessian");
conn.addHeader("Accept-Encoding", "deflate");
String basicAuth = _factory.getBasicAuth();
if (basicAuth != null)
conn.addHeader("Authorization", basicAuth... | [
"protected",
"void",
"addRequestHeaders",
"(",
"HessianConnection",
"conn",
")",
"{",
"conn",
".",
"addHeader",
"(",
"\"Content-Type\"",
",",
"\"x-application/hessian\"",
")",
";",
"conn",
".",
"addHeader",
"(",
"\"Accept-Encoding\"",
",",
"\"deflate\"",
")",
";",
... | Method that allows subclasses to add request headers such as cookies.
Default implementation is empty. | [
"Method",
"that",
"allows",
"subclasses",
"to",
"add",
"request",
"headers",
"such",
"as",
"cookies",
".",
"Default",
"implementation",
"is",
"empty",
"."
] | 89e4f5af28602101dab7b498995018871616357b | https://github.com/alipay/sofa-hessian/blob/89e4f5af28602101dab7b498995018871616357b/src/main/java/com/caucho/hessian/client/HessianProxy.java#L308-L317 | train |
alipay/sofa-hessian | src/main/java/com/caucho/hessian/client/HessianURLConnectionFactory.java | HessianURLConnectionFactory.open | public HessianConnection open(URL url)
throws IOException
{
if (log.isLoggable(Level.FINER))
log.finer(this + " open(" + url + ")");
URLConnection conn = url.openConnection();
// HttpURLConnection httpConn = (HttpURLConnection) conn;
// httpConn.setRequestMethod... | java | public HessianConnection open(URL url)
throws IOException
{
if (log.isLoggable(Level.FINER))
log.finer(this + " open(" + url + ")");
URLConnection conn = url.openConnection();
// HttpURLConnection httpConn = (HttpURLConnection) conn;
// httpConn.setRequestMethod... | [
"public",
"HessianConnection",
"open",
"(",
"URL",
"url",
")",
"throws",
"IOException",
"{",
"if",
"(",
"log",
".",
"isLoggable",
"(",
"Level",
".",
"FINER",
")",
")",
"log",
".",
"finer",
"(",
"this",
"+",
"\" open(\"",
"+",
"url",
"+",
"\")\"",
")",
... | Opens a new or recycled connection to the HTTP server. | [
"Opens",
"a",
"new",
"or",
"recycled",
"connection",
"to",
"the",
"HTTP",
"server",
"."
] | 89e4f5af28602101dab7b498995018871616357b | https://github.com/alipay/sofa-hessian/blob/89e4f5af28602101dab7b498995018871616357b/src/main/java/com/caucho/hessian/client/HessianURLConnectionFactory.java#L77-L118 | train |
alipay/sofa-hessian | src/main/java/com/caucho/services/server/ServiceContext.java | ServiceContext.begin | public static void begin(ServletRequest request,
ServletResponse response,
String serviceName,
String objectId)
throws ServletException
{
ServiceContext context = (ServiceContext) _localContext.get();
if ... | java | public static void begin(ServletRequest request,
ServletResponse response,
String serviceName,
String objectId)
throws ServletException
{
ServiceContext context = (ServiceContext) _localContext.get();
if ... | [
"public",
"static",
"void",
"begin",
"(",
"ServletRequest",
"request",
",",
"ServletResponse",
"response",
",",
"String",
"serviceName",
",",
"String",
"objectId",
")",
"throws",
"ServletException",
"{",
"ServiceContext",
"context",
"=",
"(",
"ServiceContext",
")",
... | Sets the request object prior to calling the service's method.
@param request the calling servlet request
@param serviceId the service identifier
@param objectId the object identifier | [
"Sets",
"the",
"request",
"object",
"prior",
"to",
"calling",
"the",
"service",
"s",
"method",
"."
] | 89e4f5af28602101dab7b498995018871616357b | https://github.com/alipay/sofa-hessian/blob/89e4f5af28602101dab7b498995018871616357b/src/main/java/com/caucho/services/server/ServiceContext.java#L81-L99 | train |
alipay/sofa-hessian | src/main/java/com/caucho/services/server/ServiceContext.java | ServiceContext.getContextHeader | public static Object getContextHeader(String header)
{
ServiceContext context = (ServiceContext) _localContext.get();
if (context != null)
return context.getHeader(header);
else
return null;
} | java | public static Object getContextHeader(String header)
{
ServiceContext context = (ServiceContext) _localContext.get();
if (context != null)
return context.getHeader(header);
else
return null;
} | [
"public",
"static",
"Object",
"getContextHeader",
"(",
"String",
"header",
")",
"{",
"ServiceContext",
"context",
"=",
"(",
"ServiceContext",
")",
"_localContext",
".",
"get",
"(",
")",
";",
"if",
"(",
"context",
"!=",
"null",
")",
"return",
"context",
".",
... | Gets a header from the context. | [
"Gets",
"a",
"header",
"from",
"the",
"context",
"."
] | 89e4f5af28602101dab7b498995018871616357b | https://github.com/alipay/sofa-hessian/blob/89e4f5af28602101dab7b498995018871616357b/src/main/java/com/caucho/services/server/ServiceContext.java#L128-L136 | train |
alipay/sofa-hessian | src/main/java/com/caucho/services/server/ServiceContext.java | ServiceContext.end | public static void end()
{
ServiceContext context = (ServiceContext) _localContext.get();
if (context != null && --context._count == 0) {
context._request = null;
context._response = null;
context._headers.clear();
_localContext.set(null);
}... | java | public static void end()
{
ServiceContext context = (ServiceContext) _localContext.get();
if (context != null && --context._count == 0) {
context._request = null;
context._response = null;
context._headers.clear();
_localContext.set(null);
}... | [
"public",
"static",
"void",
"end",
"(",
")",
"{",
"ServiceContext",
"context",
"=",
"(",
"ServiceContext",
")",
"_localContext",
".",
"get",
"(",
")",
";",
"if",
"(",
"context",
"!=",
"null",
"&&",
"--",
"context",
".",
"_count",
"==",
"0",
")",
"{",
... | Cleanup at the end of a request. | [
"Cleanup",
"at",
"the",
"end",
"of",
"a",
"request",
"."
] | 89e4f5af28602101dab7b498995018871616357b | https://github.com/alipay/sofa-hessian/blob/89e4f5af28602101dab7b498995018871616357b/src/main/java/com/caucho/services/server/ServiceContext.java#L193-L205 | train |
alipay/sofa-hessian | src/main/java/com/caucho/hessian/io/ArraySerializer.java | ArraySerializer.getArrayType | private String getArrayType(Class cl)
{
if (cl.isArray())
return '[' + getArrayType(cl.getComponentType());
String name = cl.getName();
if (name.equals("java.lang.String"))
return "string";
else if (name.equals("java.lang.Object"))
return "object... | java | private String getArrayType(Class cl)
{
if (cl.isArray())
return '[' + getArrayType(cl.getComponentType());
String name = cl.getName();
if (name.equals("java.lang.String"))
return "string";
else if (name.equals("java.lang.Object"))
return "object... | [
"private",
"String",
"getArrayType",
"(",
"Class",
"cl",
")",
"{",
"if",
"(",
"cl",
".",
"isArray",
"(",
")",
")",
"return",
"'",
"'",
"+",
"getArrayType",
"(",
"cl",
".",
"getComponentType",
"(",
")",
")",
";",
"String",
"name",
"=",
"cl",
".",
"g... | Returns the <type> name for a <list>. | [
"Returns",
"the",
"<",
";",
"type",
">",
"name",
"for",
"a",
"<",
";",
"list",
">",
"."
] | 89e4f5af28602101dab7b498995018871616357b | https://github.com/alipay/sofa-hessian/blob/89e4f5af28602101dab7b498995018871616357b/src/main/java/com/caucho/hessian/io/ArraySerializer.java#L78-L93 | train |
oasp/oasp4j | modules/logging/src/main/java/io/oasp/module/logging/common/impl/SingleLinePatternLayout.java | SingleLinePatternLayout.doLayout | @Override
public String doLayout(ILoggingEvent event) {
// Format message
String msg = super.doLayout(event).trim();
// prevent log forging
msg = preventLogForging(msg);
// Formatting of exception, remove line breaks
IThrowableProxy throwableProxy = event.getThrowableProxy();
if (throwab... | java | @Override
public String doLayout(ILoggingEvent event) {
// Format message
String msg = super.doLayout(event).trim();
// prevent log forging
msg = preventLogForging(msg);
// Formatting of exception, remove line breaks
IThrowableProxy throwableProxy = event.getThrowableProxy();
if (throwab... | [
"@",
"Override",
"public",
"String",
"doLayout",
"(",
"ILoggingEvent",
"event",
")",
"{",
"// Format message",
"String",
"msg",
"=",
"super",
".",
"doLayout",
"(",
"event",
")",
".",
"trim",
"(",
")",
";",
"// prevent log forging",
"msg",
"=",
"preventLogForgi... | Creates formatted String, using conversion pattern.
@param event ILoggingEvent
@return String Formatted event as string in one line | [
"Creates",
"formatted",
"String",
"using",
"conversion",
"pattern",
"."
] | 03f90132699fad95e52ec8efa54aa391f8d3c7e4 | https://github.com/oasp/oasp4j/blob/03f90132699fad95e52ec8efa54aa391f8d3c7e4/modules/logging/src/main/java/io/oasp/module/logging/common/impl/SingleLinePatternLayout.java#L49-L74 | train |
oasp/oasp4j | modules/logging/src/main/java/io/oasp/module/logging/common/impl/SingleLinePatternLayout.java | SingleLinePatternLayout.preventLogForging | private String preventLogForging(String logMsg) {
String result = logMsg;
// use precompiled pattern for performance reasons
result = LINEBREAK_PATTERN.matcher(logMsg).replaceAll(SingleLinePatternLayout.LINE_SEP);
return result;
} | java | private String preventLogForging(String logMsg) {
String result = logMsg;
// use precompiled pattern for performance reasons
result = LINEBREAK_PATTERN.matcher(logMsg).replaceAll(SingleLinePatternLayout.LINE_SEP);
return result;
} | [
"private",
"String",
"preventLogForging",
"(",
"String",
"logMsg",
")",
"{",
"String",
"result",
"=",
"logMsg",
";",
"// use precompiled pattern for performance reasons",
"result",
"=",
"LINEBREAK_PATTERN",
".",
"matcher",
"(",
"logMsg",
")",
".",
"replaceAll",
"(",
... | Method to prevent log forging.
@param logMsg
@return Encoded message | [
"Method",
"to",
"prevent",
"log",
"forging",
"."
] | 03f90132699fad95e52ec8efa54aa391f8d3c7e4 | https://github.com/oasp/oasp4j/blob/03f90132699fad95e52ec8efa54aa391f8d3c7e4/modules/logging/src/main/java/io/oasp/module/logging/common/impl/SingleLinePatternLayout.java#L82-L88 | train |
oasp/oasp4j | modules/beanmapping/src/main/java/io/oasp/module/beanmapping/common/impl/orika/CustomMapperEto.java | CustomMapperEto.initialize | @PostConstruct
public void initialize() {
if (this.pojoDescriptorBuilderFactory == null) {
this.pojoDescriptorBuilderFactory = PojoDescriptorBuilderFactoryImpl.getInstance();
}
if (this.pojoDescriptorBuilder == null) {
this.pojoDescriptorBuilder = this.pojoDescriptorBuilderFactory.createPriva... | java | @PostConstruct
public void initialize() {
if (this.pojoDescriptorBuilderFactory == null) {
this.pojoDescriptorBuilderFactory = PojoDescriptorBuilderFactoryImpl.getInstance();
}
if (this.pojoDescriptorBuilder == null) {
this.pojoDescriptorBuilder = this.pojoDescriptorBuilderFactory.createPriva... | [
"@",
"PostConstruct",
"public",
"void",
"initialize",
"(",
")",
"{",
"if",
"(",
"this",
".",
"pojoDescriptorBuilderFactory",
"==",
"null",
")",
"{",
"this",
".",
"pojoDescriptorBuilderFactory",
"=",
"PojoDescriptorBuilderFactoryImpl",
".",
"getInstance",
"(",
")",
... | Initializes this class to be functional. | [
"Initializes",
"this",
"class",
"to",
"be",
"functional",
"."
] | 03f90132699fad95e52ec8efa54aa391f8d3c7e4 | https://github.com/oasp/oasp4j/blob/03f90132699fad95e52ec8efa54aa391f8d3c7e4/modules/beanmapping/src/main/java/io/oasp/module/beanmapping/common/impl/orika/CustomMapperEto.java#L50-L60 | train |
oasp/oasp4j | modules/rest/src/main/java/io/oasp/module/rest/service/impl/RestServiceExceptionFacade.java | RestServiceExceptionFacade.handleSecurityError | protected Response handleSecurityError(Throwable exception, Throwable catched) {
NlsRuntimeException error;
if ((exception == catched) && (exception instanceof NlsRuntimeException)) {
error = (NlsRuntimeException) exception;
} else {
error = new SecurityErrorUserException(catched);
}
LO... | java | protected Response handleSecurityError(Throwable exception, Throwable catched) {
NlsRuntimeException error;
if ((exception == catched) && (exception instanceof NlsRuntimeException)) {
error = (NlsRuntimeException) exception;
} else {
error = new SecurityErrorUserException(catched);
}
LO... | [
"protected",
"Response",
"handleSecurityError",
"(",
"Throwable",
"exception",
",",
"Throwable",
"catched",
")",
"{",
"NlsRuntimeException",
"error",
";",
"if",
"(",
"(",
"exception",
"==",
"catched",
")",
"&&",
"(",
"exception",
"instanceof",
"NlsRuntimeException",... | Exception handling for security exception.
@param exception the exception to handle
@param catched the original exception that was cached. Either same as {@code error} or a (child-)
{@link Throwable#getCause() cause} of it.
@return the response build from exception | [
"Exception",
"handling",
"for",
"security",
"exception",
"."
] | 03f90132699fad95e52ec8efa54aa391f8d3c7e4 | https://github.com/oasp/oasp4j/blob/03f90132699fad95e52ec8efa54aa391f8d3c7e4/modules/rest/src/main/java/io/oasp/module/rest/service/impl/RestServiceExceptionFacade.java#L298-L316 | train |
oasp/oasp4j | modules/rest/src/main/java/io/oasp/module/rest/service/impl/RestServiceExceptionFacade.java | RestServiceExceptionFacade.handleValidationException | protected Response handleValidationException(Throwable exception, Throwable catched) {
Throwable t = catched;
Map<String, List<String>> errorsMap = null;
if (exception instanceof ConstraintViolationException) {
ConstraintViolationException constraintViolationException = (ConstraintViolationException)... | java | protected Response handleValidationException(Throwable exception, Throwable catched) {
Throwable t = catched;
Map<String, List<String>> errorsMap = null;
if (exception instanceof ConstraintViolationException) {
ConstraintViolationException constraintViolationException = (ConstraintViolationException)... | [
"protected",
"Response",
"handleValidationException",
"(",
"Throwable",
"exception",
",",
"Throwable",
"catched",
")",
"{",
"Throwable",
"t",
"=",
"catched",
";",
"Map",
"<",
"String",
",",
"List",
"<",
"String",
">",
">",
"errorsMap",
"=",
"null",
";",
"if"... | Exception handling for validation exception.
@param exception the exception to handle
@param catched the original exception that was cached. Either same as {@code error} or a (child-)
{@link Throwable#getCause() cause} of it.
@return the response build from the exception. | [
"Exception",
"handling",
"for",
"validation",
"exception",
"."
] | 03f90132699fad95e52ec8efa54aa391f8d3c7e4 | https://github.com/oasp/oasp4j/blob/03f90132699fad95e52ec8efa54aa391f8d3c7e4/modules/rest/src/main/java/io/oasp/module/rest/service/impl/RestServiceExceptionFacade.java#L326-L359 | train |
oasp/oasp4j | modules/rest/src/main/java/io/oasp/module/rest/service/impl/RestServiceExceptionFacade.java | RestServiceExceptionFacade.createResponse | protected Response createResponse(WebApplicationException exception) {
Response response = exception.getResponse();
int statusCode = response.getStatus();
Status status = Status.fromStatusCode(statusCode);
NlsRuntimeException error;
if (exception instanceof ServerErrorException) {
error = new... | java | protected Response createResponse(WebApplicationException exception) {
Response response = exception.getResponse();
int statusCode = response.getStatus();
Status status = Status.fromStatusCode(statusCode);
NlsRuntimeException error;
if (exception instanceof ServerErrorException) {
error = new... | [
"protected",
"Response",
"createResponse",
"(",
"WebApplicationException",
"exception",
")",
"{",
"Response",
"response",
"=",
"exception",
".",
"getResponse",
"(",
")",
";",
"int",
"statusCode",
"=",
"response",
".",
"getStatus",
"(",
")",
";",
"Status",
"statu... | Add a response message to an existing response.
@param exception the {@link WebApplicationException}.
@return the response with the response message added | [
"Add",
"a",
"response",
"message",
"to",
"an",
"existing",
"response",
"."
] | 03f90132699fad95e52ec8efa54aa391f8d3c7e4 | https://github.com/oasp/oasp4j/blob/03f90132699fad95e52ec8efa54aa391f8d3c7e4/modules/rest/src/main/java/io/oasp/module/rest/service/impl/RestServiceExceptionFacade.java#L509-L529 | train |
oasp/oasp4j | modules/security/src/main/java/io/oasp/module/security/common/base/accesscontrol/AbstractAccessControlProvider.java | AbstractAccessControlProvider.initialize | protected void initialize(AccessControlSchema config) {
LOG.debug("Initializing.");
List<AccessControlGroup> groups = config.getGroups();
if (groups.size() == 0) {
throw new IllegalStateException("AccessControlSchema is empty - please configure at least one group!");
}
Set<AccessControlGroup>... | java | protected void initialize(AccessControlSchema config) {
LOG.debug("Initializing.");
List<AccessControlGroup> groups = config.getGroups();
if (groups.size() == 0) {
throw new IllegalStateException("AccessControlSchema is empty - please configure at least one group!");
}
Set<AccessControlGroup>... | [
"protected",
"void",
"initialize",
"(",
"AccessControlSchema",
"config",
")",
"{",
"LOG",
".",
"debug",
"(",
"\"Initializing.\"",
")",
";",
"List",
"<",
"AccessControlGroup",
">",
"groups",
"=",
"config",
".",
"getGroups",
"(",
")",
";",
"if",
"(",
"groups",... | Performs the required initialization of this class.
@param config is the {@link AccessControlSchema}. | [
"Performs",
"the",
"required",
"initialization",
"of",
"this",
"class",
"."
] | 03f90132699fad95e52ec8efa54aa391f8d3c7e4 | https://github.com/oasp/oasp4j/blob/03f90132699fad95e52ec8efa54aa391f8d3c7e4/modules/security/src/main/java/io/oasp/module/security/common/base/accesscontrol/AbstractAccessControlProvider.java#L47-L61 | train |
oasp/oasp4j | modules/rest/src/main/java/io/oasp/module/rest/service/api/RequestParameters.java | RequestParameters.get | @SuppressWarnings("unchecked")
public <T> T get(String key, Class<T> targetType, boolean required) throws WebApplicationException {
String value = get(key);
if (value == null) {
if (required) {
throw new BadRequestException("Missing parameter: " + key);
}
Object result = null;
... | java | @SuppressWarnings("unchecked")
public <T> T get(String key, Class<T> targetType, boolean required) throws WebApplicationException {
String value = get(key);
if (value == null) {
if (required) {
throw new BadRequestException("Missing parameter: " + key);
}
Object result = null;
... | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"<",
"T",
">",
"T",
"get",
"(",
"String",
"key",
",",
"Class",
"<",
"T",
">",
"targetType",
",",
"boolean",
"required",
")",
"throws",
"WebApplicationException",
"{",
"String",
"value",
"=",
"ge... | Gets the single parameter in a generic and flexible way.
@param <T> is the generic type of <code>targetType</code>.
@param key is the {@link java.util.Map#get(Object) key} of the parameter to get.
@param targetType is the {@link Class} reflecting the type to convert the value to. Supports common Java standard
types su... | [
"Gets",
"the",
"single",
"parameter",
"in",
"a",
"generic",
"and",
"flexible",
"way",
"."
] | 03f90132699fad95e52ec8efa54aa391f8d3c7e4 | https://github.com/oasp/oasp4j/blob/03f90132699fad95e52ec8efa54aa391f8d3c7e4/modules/rest/src/main/java/io/oasp/module/rest/service/api/RequestParameters.java#L54-L91 | train |
Atmosphere/atmosphere-samples | samples/cxf-chat-osgi/src/main/java/org/atmosphere/samples/chat/cxf/ChatResource.java | ChatResource.suspend | @GET
public String suspend() {
AtmosphereResource r = (AtmosphereResource)req.getAttribute("org.atmosphere.cpr.AtmosphereResource");
r.setBroadcaster(r.getAtmosphereConfig().getBroadcasterFactory().lookup("/cxf-chat", true)).suspend();
return "";
} | java | @GET
public String suspend() {
AtmosphereResource r = (AtmosphereResource)req.getAttribute("org.atmosphere.cpr.AtmosphereResource");
r.setBroadcaster(r.getAtmosphereConfig().getBroadcasterFactory().lookup("/cxf-chat", true)).suspend();
return "";
} | [
"@",
"GET",
"public",
"String",
"suspend",
"(",
")",
"{",
"AtmosphereResource",
"r",
"=",
"(",
"AtmosphereResource",
")",
"req",
".",
"getAttribute",
"(",
"\"org.atmosphere.cpr.AtmosphereResource\"",
")",
";",
"r",
".",
"setBroadcaster",
"(",
"r",
".",
"getAtmos... | Suspend the response without writing anything back to the client.
@return a white space | [
"Suspend",
"the",
"response",
"without",
"writing",
"anything",
"back",
"to",
"the",
"client",
"."
] | 2b33c0c7a73b3f9b4597cb52ce5602834b80af99 | https://github.com/Atmosphere/atmosphere-samples/blob/2b33c0c7a73b3f9b4597cb52ce5602834b80af99/samples/cxf-chat-osgi/src/main/java/org/atmosphere/samples/chat/cxf/ChatResource.java#L45-L50 | train |
Atmosphere/atmosphere-samples | extensions-samples/gwt/gwt20-rpc/src/main/java/org/atmosphere/samples/server/GwtRpcAtmosphereHandler.java | GwtRpcAtmosphereHandler.doPost | public void doPost(AtmosphereResource ar) {
Object msg = ar.getRequest().getAttribute(Constants.MESSAGE_OBJECT);
if (msg != null) {
logger.info("received RPC post: " + msg.toString());
// for demonstration purposes we will broadcast the message to all connections
ar.getAt... | java | public void doPost(AtmosphereResource ar) {
Object msg = ar.getRequest().getAttribute(Constants.MESSAGE_OBJECT);
if (msg != null) {
logger.info("received RPC post: " + msg.toString());
// for demonstration purposes we will broadcast the message to all connections
ar.getAt... | [
"public",
"void",
"doPost",
"(",
"AtmosphereResource",
"ar",
")",
"{",
"Object",
"msg",
"=",
"ar",
".",
"getRequest",
"(",
")",
".",
"getAttribute",
"(",
"Constants",
".",
"MESSAGE_OBJECT",
")",
";",
"if",
"(",
"msg",
"!=",
"null",
")",
"{",
"logger",
... | receive push message from client | [
"receive",
"push",
"message",
"from",
"client"
] | 2b33c0c7a73b3f9b4597cb52ce5602834b80af99 | https://github.com/Atmosphere/atmosphere-samples/blob/2b33c0c7a73b3f9b4597cb52ce5602834b80af99/extensions-samples/gwt/gwt20-rpc/src/main/java/org/atmosphere/samples/server/GwtRpcAtmosphereHandler.java#L53-L60 | train |
Atmosphere/atmosphere-samples | samples/jersey2-chat/src/main/java/org/atmosphere/samples/chat/jersey/Jersey2Resource.java | Jersey2Resource.broadcast | @POST
public void broadcast(String message) {
AtmosphereResource r = (AtmosphereResource) request.getAttribute(ApplicationConfig.ATMOSPHERE_RESOURCE);
if (r != null) {
r.getBroadcaster().broadcast(message);
} else {
throw new IllegalStateException();
}
} | java | @POST
public void broadcast(String message) {
AtmosphereResource r = (AtmosphereResource) request.getAttribute(ApplicationConfig.ATMOSPHERE_RESOURCE);
if (r != null) {
r.getBroadcaster().broadcast(message);
} else {
throw new IllegalStateException();
}
} | [
"@",
"POST",
"public",
"void",
"broadcast",
"(",
"String",
"message",
")",
"{",
"AtmosphereResource",
"r",
"=",
"(",
"AtmosphereResource",
")",
"request",
".",
"getAttribute",
"(",
"ApplicationConfig",
".",
"ATMOSPHERE_RESOURCE",
")",
";",
"if",
"(",
"r",
"!="... | Echo the chat message. Jackson can clearly be used here, but for simplicity we just echo what we receive.
@param message | [
"Echo",
"the",
"chat",
"message",
".",
"Jackson",
"can",
"clearly",
"be",
"used",
"here",
"but",
"for",
"simplicity",
"we",
"just",
"echo",
"what",
"we",
"receive",
"."
] | 2b33c0c7a73b3f9b4597cb52ce5602834b80af99 | https://github.com/Atmosphere/atmosphere-samples/blob/2b33c0c7a73b3f9b4597cb52ce5602834b80af99/samples/jersey2-chat/src/main/java/org/atmosphere/samples/chat/jersey/Jersey2Resource.java#L78-L87 | train |
Atmosphere/atmosphere-samples | samples/chat/src/main/java/org/atmosphere/samples/chat/Chat.java | Chat.onReady | @Ready
public void onReady(/* In you don't want injection AtmosphereResource r */) {
logger.info("Browser {} connected", r.uuid());
logger.info("BroadcasterFactory used {}", factory.getClass().getName());
logger.info("Broadcaster injected {}", broadcaster.getID());
} | java | @Ready
public void onReady(/* In you don't want injection AtmosphereResource r */) {
logger.info("Browser {} connected", r.uuid());
logger.info("BroadcasterFactory used {}", factory.getClass().getName());
logger.info("Broadcaster injected {}", broadcaster.getID());
} | [
"@",
"Ready",
"public",
"void",
"onReady",
"(",
"/* In you don't want injection AtmosphereResource r */",
")",
"{",
"logger",
".",
"info",
"(",
"\"Browser {} connected\"",
",",
"r",
".",
"uuid",
"(",
")",
")",
";",
"logger",
".",
"info",
"(",
"\"BroadcasterFactory... | Invoked when the connection has been fully established and suspended, that is, ready for receiving messages. | [
"Invoked",
"when",
"the",
"connection",
"has",
"been",
"fully",
"established",
"and",
"suspended",
"that",
"is",
"ready",
"for",
"receiving",
"messages",
"."
] | 2b33c0c7a73b3f9b4597cb52ce5602834b80af99 | https://github.com/Atmosphere/atmosphere-samples/blob/2b33c0c7a73b3f9b4597cb52ce5602834b80af99/samples/chat/src/main/java/org/atmosphere/samples/chat/Chat.java#L75-L81 | train |
Atmosphere/atmosphere-samples | samples/pubsub/src/main/java/org/atmosphere/samples/pubsub/PubSub.java | PubSub.publishWithXML | @POST
@Produces("application/xml")
@Broadcast
public Broadcastable publishWithXML(@FormParam("message") String message) {
return new Broadcastable(new JAXBBean(message), broadcaster);
} | java | @POST
@Produces("application/xml")
@Broadcast
public Broadcastable publishWithXML(@FormParam("message") String message) {
return new Broadcastable(new JAXBBean(message), broadcaster);
} | [
"@",
"POST",
"@",
"Produces",
"(",
"\"application/xml\"",
")",
"@",
"Broadcast",
"public",
"Broadcastable",
"publishWithXML",
"(",
"@",
"FormParam",
"(",
"\"message\"",
")",
"String",
"message",
")",
"{",
"return",
"new",
"Broadcastable",
"(",
"new",
"JAXBBean",... | '
Broadcast XML data using JAXB
@param message A String from an HTML form
@return A {@link Broadcastable} used to broadcast events. | [
"Broadcast",
"XML",
"data",
"using",
"JAXB"
] | 2b33c0c7a73b3f9b4597cb52ce5602834b80af99 | https://github.com/Atmosphere/atmosphere-samples/blob/2b33c0c7a73b3f9b4597cb52ce5602834b80af99/samples/pubsub/src/main/java/org/atmosphere/samples/pubsub/PubSub.java#L157-L162 | train |
Atmosphere/atmosphere-samples | samples/pubsub/src/main/java/org/atmosphere/samples/pubsub/PubSub.java | PubSub.timeout | @GET
@Suspend(period = 60, timeUnit = TimeUnit.SECONDS, listeners = {EventsLogger.class})
@Path("timeout")
public Broadcastable timeout() {
return new Broadcastable(broadcaster);
} | java | @GET
@Suspend(period = 60, timeUnit = TimeUnit.SECONDS, listeners = {EventsLogger.class})
@Path("timeout")
public Broadcastable timeout() {
return new Broadcastable(broadcaster);
} | [
"@",
"GET",
"@",
"Suspend",
"(",
"period",
"=",
"60",
",",
"timeUnit",
"=",
"TimeUnit",
".",
"SECONDS",
",",
"listeners",
"=",
"{",
"EventsLogger",
".",
"class",
"}",
")",
"@",
"Path",
"(",
"\"timeout\"",
")",
"public",
"Broadcastable",
"timeout",
"(",
... | Timeout the resource
@return A {@link Broadcastable} used to broadcast events. | [
"Timeout",
"the",
"resource"
] | 2b33c0c7a73b3f9b4597cb52ce5602834b80af99 | https://github.com/Atmosphere/atmosphere-samples/blob/2b33c0c7a73b3f9b4597cb52ce5602834b80af99/samples/pubsub/src/main/java/org/atmosphere/samples/pubsub/PubSub.java#L288-L293 | train |
algolia/algoliasearch-client-java | src/main/java/com/algolia/search/saas/Index.java | Index.addObject | public JSONObject addObject(JSONObject obj, RequestOptions requestOptions) throws AlgoliaException {
return client.postRequest("/1/indexes/" + encodedIndexName, obj.toString(), true, false, requestOptions);
} | java | public JSONObject addObject(JSONObject obj, RequestOptions requestOptions) throws AlgoliaException {
return client.postRequest("/1/indexes/" + encodedIndexName, obj.toString(), true, false, requestOptions);
} | [
"public",
"JSONObject",
"addObject",
"(",
"JSONObject",
"obj",
",",
"RequestOptions",
"requestOptions",
")",
"throws",
"AlgoliaException",
"{",
"return",
"client",
".",
"postRequest",
"(",
"\"/1/indexes/\"",
"+",
"encodedIndexName",
",",
"obj",
".",
"toString",
"(",... | Add an object in this index
@param obj the object to add
@param requestOptions Options to pass to this request | [
"Add",
"an",
"object",
"in",
"this",
"index"
] | a05da2f66c099fe6f77295c7b6a8a12c24e95f9b | https://github.com/algolia/algoliasearch-client-java/blob/a05da2f66c099fe6f77295c7b6a8a12c24e95f9b/src/main/java/com/algolia/search/saas/Index.java#L83-L85 | train |
algolia/algoliasearch-client-java | src/main/java/com/algolia/search/saas/Index.java | Index.addObjects | public JSONObject addObjects(List<JSONObject> objects) throws AlgoliaException {
return this.addObjects(objects, RequestOptions.empty);
} | java | public JSONObject addObjects(List<JSONObject> objects) throws AlgoliaException {
return this.addObjects(objects, RequestOptions.empty);
} | [
"public",
"JSONObject",
"addObjects",
"(",
"List",
"<",
"JSONObject",
">",
"objects",
")",
"throws",
"AlgoliaException",
"{",
"return",
"this",
".",
"addObjects",
"(",
"objects",
",",
"RequestOptions",
".",
"empty",
")",
";",
"}"
] | Add several objects
@param objects the array of objects to add | [
"Add",
"several",
"objects"
] | a05da2f66c099fe6f77295c7b6a8a12c24e95f9b | https://github.com/algolia/algoliasearch-client-java/blob/a05da2f66c099fe6f77295c7b6a8a12c24e95f9b/src/main/java/com/algolia/search/saas/Index.java#L167-L169 | train |
algolia/algoliasearch-client-java | src/main/java/com/algolia/search/saas/Index.java | Index.saveObject | public JSONObject saveObject(JSONObject object, String objectID) throws AlgoliaException {
return this.saveObject(object, objectID, RequestOptions.empty);
} | java | public JSONObject saveObject(JSONObject object, String objectID) throws AlgoliaException {
return this.saveObject(object, objectID, RequestOptions.empty);
} | [
"public",
"JSONObject",
"saveObject",
"(",
"JSONObject",
"object",
",",
"String",
"objectID",
")",
"throws",
"AlgoliaException",
"{",
"return",
"this",
".",
"saveObject",
"(",
"object",
",",
"objectID",
",",
"RequestOptions",
".",
"empty",
")",
";",
"}"
] | Override the content of object
@param object the object to update | [
"Override",
"the",
"content",
"of",
"object"
] | a05da2f66c099fe6f77295c7b6a8a12c24e95f9b | https://github.com/algolia/algoliasearch-client-java/blob/a05da2f66c099fe6f77295c7b6a8a12c24e95f9b/src/main/java/com/algolia/search/saas/Index.java#L477-L479 | train |
algolia/algoliasearch-client-java | src/main/java/com/algolia/search/saas/Index.java | Index.saveObjects | public JSONObject saveObjects(List<JSONObject> objects) throws AlgoliaException {
return this.saveObjects(objects, RequestOptions.empty);
} | java | public JSONObject saveObjects(List<JSONObject> objects) throws AlgoliaException {
return this.saveObjects(objects, RequestOptions.empty);
} | [
"public",
"JSONObject",
"saveObjects",
"(",
"List",
"<",
"JSONObject",
">",
"objects",
")",
"throws",
"AlgoliaException",
"{",
"return",
"this",
".",
"saveObjects",
"(",
"objects",
",",
"RequestOptions",
".",
"empty",
")",
";",
"}"
] | Override the content of several objects
@param objects the array of objects to update (each object must contains an objectID attribute) | [
"Override",
"the",
"content",
"of",
"several",
"objects"
] | a05da2f66c099fe6f77295c7b6a8a12c24e95f9b | https://github.com/algolia/algoliasearch-client-java/blob/a05da2f66c099fe6f77295c7b6a8a12c24e95f9b/src/main/java/com/algolia/search/saas/Index.java#L500-L502 | train |
algolia/algoliasearch-client-java | src/main/java/com/algolia/search/saas/Index.java | Index.search | public JSONObject search(Query params, RequestOptions requestOptions) throws AlgoliaException {
String paramsString = params.getQueryString();
JSONObject body = new JSONObject();
try {
body.put("params", paramsString);
} catch (JSONException e) {
throw new RuntimeException(e);
}
retu... | java | public JSONObject search(Query params, RequestOptions requestOptions) throws AlgoliaException {
String paramsString = params.getQueryString();
JSONObject body = new JSONObject();
try {
body.put("params", paramsString);
} catch (JSONException e) {
throw new RuntimeException(e);
}
retu... | [
"public",
"JSONObject",
"search",
"(",
"Query",
"params",
",",
"RequestOptions",
"requestOptions",
")",
"throws",
"AlgoliaException",
"{",
"String",
"paramsString",
"=",
"params",
".",
"getQueryString",
"(",
")",
";",
"JSONObject",
"body",
"=",
"new",
"JSONObject"... | Search inside the index
@param the query to search
@param requestOptions Options to pass to this request | [
"Search",
"inside",
"the",
"index"
] | a05da2f66c099fe6f77295c7b6a8a12c24e95f9b | https://github.com/algolia/algoliasearch-client-java/blob/a05da2f66c099fe6f77295c7b6a8a12c24e95f9b/src/main/java/com/algolia/search/saas/Index.java#L692-L701 | train |
algolia/algoliasearch-client-java | src/main/java/com/algolia/search/saas/Index.java | Index.browseFrom | public IndexBrowser browseFrom(Query params, String cursor, RequestOptions requestOptions) throws AlgoliaException {
return new IndexBrowser(client, encodedIndexName, params, cursor, requestOptions);
} | java | public IndexBrowser browseFrom(Query params, String cursor, RequestOptions requestOptions) throws AlgoliaException {
return new IndexBrowser(client, encodedIndexName, params, cursor, requestOptions);
} | [
"public",
"IndexBrowser",
"browseFrom",
"(",
"Query",
"params",
",",
"String",
"cursor",
",",
"RequestOptions",
"requestOptions",
")",
"throws",
"AlgoliaException",
"{",
"return",
"new",
"IndexBrowser",
"(",
"client",
",",
"encodedIndexName",
",",
"params",
",",
"... | Browse all index content starting from a cursor
@param requestOptions Options to pass to this request | [
"Browse",
"all",
"index",
"content",
"starting",
"from",
"a",
"cursor"
] | a05da2f66c099fe6f77295c7b6a8a12c24e95f9b | https://github.com/algolia/algoliasearch-client-java/blob/a05da2f66c099fe6f77295c7b6a8a12c24e95f9b/src/main/java/com/algolia/search/saas/Index.java#L802-L804 | train |
algolia/algoliasearch-client-java | src/main/java/com/algolia/search/saas/Index.java | Index.getSettings | public JSONObject getSettings(RequestOptions requestOptions) throws AlgoliaException {
return client.getRequest("/1/indexes/" + encodedIndexName + "/settings?getVersion=2", false, requestOptions);
} | java | public JSONObject getSettings(RequestOptions requestOptions) throws AlgoliaException {
return client.getRequest("/1/indexes/" + encodedIndexName + "/settings?getVersion=2", false, requestOptions);
} | [
"public",
"JSONObject",
"getSettings",
"(",
"RequestOptions",
"requestOptions",
")",
"throws",
"AlgoliaException",
"{",
"return",
"client",
".",
"getRequest",
"(",
"\"/1/indexes/\"",
"+",
"encodedIndexName",
"+",
"\"/settings?getVersion=2\"",
",",
"false",
",",
"request... | Get settings of this index
@param requestOptions Options to pass to this request | [
"Get",
"settings",
"of",
"this",
"index"
] | a05da2f66c099fe6f77295c7b6a8a12c24e95f9b | https://github.com/algolia/algoliasearch-client-java/blob/a05da2f66c099fe6f77295c7b6a8a12c24e95f9b/src/main/java/com/algolia/search/saas/Index.java#L905-L907 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.