下面列出了java.io.ObjectInput#readShort ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
public void readExternal(ObjectInput in)
throws IOException, ClassNotFoundException
{
z = in.readBoolean();
b = in.readByte();
c = in.readChar();
s = in.readShort();
i = in.readInt();
f = in.readFloat();
j = in.readLong();
d = in.readDouble();
str = (String) in.readObject();
parent = in.readObject();
left = in.readObject();
right = in.readObject();
}
private FrenchRepublicanCalendar readFrenchRev(ObjectInput in)
throws IOException, ClassNotFoundException {
int year = in.readInt();
int doy = in.readShort();
if (doy <= 360) {
int m = ((doy - 1) / 30) + 1;
int dom = ((doy - 1) % 30) + 1;
return FrenchRepublicanCalendar.of(year, m, dom);
} else {
Sansculottides s = Sansculottides.valueOf(doy - 360);
return FrenchRepublicanCalendar.of(year, s);
}
}
/** {@inheritDoc} */
@Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
arg = in.readObject();
isVal = in.readBoolean();
bVal = in.readByte();
cVal = in.readChar();
sVal = in.readShort();
intVal = in.readInt();
lVal = in.readLong();
fltVal = in.readFloat();
dblVal = in.readDouble();
strVal = (String)in.readObject();
arrVal = (Object[])in.readObject();
eVal = (TestJobEnum)in.readObject();
}
@Override
public void readExternal(ObjectInput objectInput) throws IOException, ClassNotFoundException {
byte attributeFlags = objectInput.readByte();
int value;
switch (attributeFlags) {
case 1:
value = objectInput.readByte();
fIntValue = value;
return;
case 2:
value = objectInput.readShort();
fIntValue = value;
return;
case 4:
value = objectInput.readInt();
fIntValue = value;
return;
default:
}
}
@Override
public void readExternal(ObjectInput objectInput) throws IOException, ClassNotFoundException {
this.fEvalFlags = objectInput.readShort();
// int size;
// byte attributeFlags = objectInput.readByte();
// if (attributeFlags != 0) {
// size = attributeFlags;
// int exprIDSize = objectInput.readByte();
// for (int i = 0; i < exprIDSize; i++) {
// set(i, F.GLOBAL_IDS[objectInput.readShort()]);
// }
// for (int i = exprIDSize; i < size; i++) {
// set(i, (IExpr) objectInput.readObject());
// }
// return;
// }
// size = objectInput.readInt();
for (int i = 1; i < SIZE; i++) {
set(i, (IExpr) objectInput.readObject());
}
}
@Override
public void readExternal(ObjectInput objectInput) throws IOException, ClassNotFoundException {
short ordinal = objectInput.readShort();
fSetFlags = ordinal & 0x7FFF;
fLhsPatternExpr = (IExpr) objectInput.readObject();
fRightHandSide = (IExpr) objectInput.readObject();
if ((ordinal & 0x8000) == 0x0000) {
fPatternCondition = (IExpr) objectInput.readObject();
}
if (fLhsPatternExpr != null) {
int[] priority = new int[] { IPatternMap.DEFAULT_RULE_PRIORITY };
this.fPatternMap = IPatternMap.determinePatterns(fLhsPatternExpr, priority);
}
initRHSleafCountSimplify();
}
public void readExternal(ObjectInput in)
throws IOException, ClassNotFoundException
{
z = in.readBoolean();
b = in.readByte();
c = in.readChar();
s = in.readShort();
i = in.readInt();
f = in.readFloat();
j = in.readLong();
d = in.readDouble();
str = (String) in.readObject();
parent = in.readObject();
left = in.readObject();
right = in.readObject();
}
@Override
public void readExternal(ObjectInput objectInput) throws IOException, ClassNotFoundException {
this.fEvalFlags = objectInput.readShort();
int size;
byte attributeFlags = objectInput.readByte();
if (attributeFlags != 0) {
size = attributeFlags;
int exprIDSize = objectInput.readByte();
for (int i = 0; i < exprIDSize; i++) {
set(i, F.exprID(objectInput.readShort()));// F.GLOBAL_IDS[objectInput.readShort()]);
}
for (int i = exprIDSize; i < size; i++) {
set(i, (IExpr) objectInput.readObject());
}
return;
}
size = objectInput.readInt();
for (int i = 0; i < size; i++) {
set(i, (IExpr) objectInput.readObject());
}
}
public void receive(byte code, ObjectInput in)
throws IOException, ClassNotFoundException {
JServerRequestInfo info = new JRMPServerRequestInfoImpl();
int len = in.readShort();
for (int i = 0; i < len; i++) {
info.add_reply_service_context((JServiceContext) in.readObject());
}
for (int i = 0; i < sis.length; i++) {
sis[i].receive_request(info);
}
}
/**
* Read an XML value from an input stream.
* @param in The stream from which we're reading.
*/
public void readExternal(ObjectInput in) throws IOException
{
if (xmlStringValue == null)
// GemStone changes BEGIN
{
// use SQLVarchar by default to get correct lengths
xmlStringValue = new SQLVarchar();
}
/* (original code)
xmlStringValue = new SQLChar();
*/
// GemStone changes END
// Read the XML implementation id. Right now there's
// only one implementation (UTF-8 based), so we don't
// use this value. But if better implementations come
// up in the future, we'll have to use this impl id to
// figure out how to read the data.
in.readShort();
// Now just read the XML data as UTF-8.
xmlStringValue.readExternal(in);
// If we read it from disk then it must have type
// XML_DOC_ANY because that's all we allow to be
// written into an XML column.
setXType(XML_DOC_ANY);
}
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
boolean name_available=in.readBoolean();
if(name_available)
method_name=in.readUTF();
else
method_id=in.readShort();
args=(Object[])in.readObject();
mode=in.readShort();
switch(mode) {
case OLD:
break;
case METHOD:
Class[] parametertypes=(Class[])in.readObject();
Class declaringclass=(Class)in.readObject();
try {
method=declaringclass.getDeclaredMethod(method_name, parametertypes);
}
catch(NoSuchMethodException e) {
throw new IOException(e.toString());
}
break;
case TYPES:
types=(Class[])in.readObject();
break;
case SIGNATURE:
signature=(String[])in.readObject();
break;
case ID:
break;
default:
if(log.isErrorEnabled()) log.error(ExternalStrings.MethodCall_MODE__0__IS_INVALID, mode);
break;
}
boolean payload_available=in.readBoolean();
if(payload_available) {
payload=(Map)in.readObject();
}
}
/**
* Read this object from a stream of stored objects.
*
* @param in read this.
*
* @exception IOException thrown on error
* @exception ClassNotFoundException thrown on error
*/
public void readExternal( ObjectInput in )
throws IOException, ClassNotFoundException
{
super.readExternal(in);
specificName = (String) in.readObject();
dynamicResultSets = in.readInt();
parameterCount = in.readInt();
parameterStyle = in.readShort();
sqlAllowed = in.readShort();
returnType = getStoredType(in.readObject());
calledOnNullInput = in.readBoolean();
in.readInt(); // future expansion.
if (parameterCount != 0) {
parameterNames = new String[parameterCount];
parameterTypes = new TypeDescriptor[parameterCount];
ArrayUtil.readArrayItems(in, parameterNames);
for (int p = 0; p < parameterTypes.length; p++)
{
parameterTypes[p] = getStoredType(in.readObject());
}
parameterModes = ArrayUtil.readIntArray(in);
} else {
parameterNames = null;
parameterTypes = null;
parameterModes = null;
}
}
public void readExternal(ObjectInput in) throws IOException,
ClassNotFoundException {
this.bucketId = ClientSharedUtils.getJdkHelper().newInteger(in.readInt());
this.primaryBucketServersStr = in.readUTF();
int secServerArrayLen = in.readShort();
// 0 indicates no secondary server length sent from server
if (secServerArrayLen != -1) {
this.secondaryBucketServersStr = new String[secServerArrayLen];
for (int i = 0; i < secServerArrayLen; i++) {
this.secondaryBucketServersStr[i] = in.readUTF();
}
}
}
@Override
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
fixedLen = in.readShort();
}
@Override
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
fixedLen = in.readShort();
}
@Override
public void readParameter(ObjectInput in) throws IOException, ClassNotFoundException
{
this.newValue = in.readShort();
}
@Override
public void readExternal(final ObjectInput in) throws IOException, ClassNotFoundException {
final byte version = in.readByte(); // future use
ThreadPoolExecutor executorService;
if (version > 1) {
if (in.readBoolean()) {
final int queue = in.readInt();
final BlockingQueue<Runnable> blockingQueue = new LinkedBlockingQueue<Runnable>((queue < 2 ? 2 : queue));
final int threads = in.readInt();
executorService = JNDIContext.newExecutor(threads, blockingQueue);
} else {
executorService = null;
}
} else {
executorService = JNDIContext.globalExecutor();
}
final ClientMetaData client = new ClientMetaData();
final EJBMetaDataImpl ejb = new EJBMetaDataImpl();
final ServerMetaData server = new ServerMetaData();
client.setMetaData(metaData);
client.readExternal(in);
ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
if (classLoader == null) {
classLoader = this.getClass().getClassLoader();
}
ejb.homeClass = loadClass(classLoader, (String) in.readObject());
ejb.remoteClass = loadClass(classLoader, (String) in.readObject());
ejb.keyClass = loadClass(classLoader, (String) in.readObject());
ejb.type = in.readByte();
ejb.deploymentID = in.readUTF();
ejb.deploymentCode = in.readShort();
server.setMetaData(metaData);
server.readExternal(in);
final Object primaryKey = in.readObject();
handler = EJBObjectHandler.createEJBObjectHandler(executorService, ejb, server, client, primaryKey, null);
ejbObjectProxy = handler.createEJBObjectProxy();
}
@Override
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
fixedLen = in.readShort();
}
@Override
public void readExternal(final ObjectInput in) throws IOException,
ClassNotFoundException {
final short version = in.readShort();
if (version != VERSION0)
throw new RuntimeException("Bad version for serialization");
sze = in.readInt();
chk = in.readInt();
}
public void readExternal(final ObjectInput in) throws IOException, ClassNotFoundException {
final short version = in.readShort();
if (version != VERSION0)
throw new IOException("Unknown version=" + version);
this.schema = (Schema)in.readObject();
this.writeTime = in.readLong();
this.tuples = new TreeMap<TP,ITPV>();
this.preconditionOk = in.readBoolean();
// #of tuples.
final int n = in.readInt();
if (log.isDebugEnabled())
log.info("n=" + n + ", schema=" + schema);
for (int i = 0; i < n; i++) {
final String name = in.readUTF();
final long timestamp = in.readLong();
final int nbytes = in.readInt() - 1;
final byte[] val = (nbytes == -1 ? null : new byte[nbytes]);
if (val != null) {
in.readFully(val);
}
final Object value = ValueType.decode(val);
final TPV tpv = new TPV(schema,name,timestamp,value);
tuples.put(new TP(name, timestamp), tpv);
if (log.isDebugEnabled())
log.info("tuple: name=" + name + ", timestamp=" + timestamp
+ ", value=" + value);
}
}