mirror of
https://github.com/wahyd4/pinpoint.git
synced 2026-08-21 02:35:53 +10:00
[강운덕] [LUCYSUS-1744] serializer api 수정.
git-svn-id: http://svn.bds.nhncorp.com/pe/hippo-tomcat-profiler/trunk@1543 84d0f5b1-2673-498c-a247-62c4ff18d310
This commit is contained in:
@@ -39,17 +39,20 @@ public class HeaderTBaseSerializer {
|
||||
*/
|
||||
public HeaderTBaseSerializer() {
|
||||
|
||||
this(new TCompactProtocol.Factory());
|
||||
this(new TCompactProtocol.Factory(), new DefaultTBaseLocator());
|
||||
}
|
||||
|
||||
private TBaseLocator locator;
|
||||
|
||||
/**
|
||||
* Create a new TSerializer. It will use the TProtocol specified by the
|
||||
* factory that is passed in.
|
||||
*
|
||||
* @param protocolFactory Factory to create a protocol
|
||||
*/
|
||||
public HeaderTBaseSerializer(TProtocolFactory protocolFactory) {
|
||||
public HeaderTBaseSerializer(TProtocolFactory protocolFactory, TBaseLocator locator) {
|
||||
protocol_ = protocolFactory.getProtocol(transport_);
|
||||
this.locator = locator;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -60,7 +63,8 @@ public class HeaderTBaseSerializer {
|
||||
* @param base The object to serialize
|
||||
* @return Serialized object in byte[] format
|
||||
*/
|
||||
public byte[] serialize(Header header, TBase<?, ?> base) throws TException {
|
||||
public byte[] serialize(TBase<?, ?> base) throws TException {
|
||||
final Header header = locator.headerLookup(base);
|
||||
baos_.reset();
|
||||
writeHeader(header);
|
||||
base.write(protocol_);
|
||||
@@ -90,9 +94,9 @@ public class HeaderTBaseSerializer {
|
||||
* @param charset Valid JVM charset
|
||||
* @return Serialized object as a String
|
||||
*/
|
||||
public String toString(Header header, TBase<?, ?> base, String charset) throws TException {
|
||||
public String toString(TBase<?, ?> base, String charset) throws TException {
|
||||
try {
|
||||
return new String(serialize(header, base), charset);
|
||||
return new String(serialize(base), charset);
|
||||
} catch (UnsupportedEncodingException uex) {
|
||||
throw new TException("JVM DOES NOT SUPPORT ENCODING: " + charset);
|
||||
}
|
||||
@@ -105,7 +109,7 @@ public class HeaderTBaseSerializer {
|
||||
* @param base The object to serialize
|
||||
* @return Serialized object as a String
|
||||
*/
|
||||
public String toString(Header header, TBase<?, ?> base) throws TException {
|
||||
return new String(serialize(header, base));
|
||||
public String toString(TBase<?, ?> base) throws TException {
|
||||
return new String(serialize(base));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user