List of usage examples for java.io ObjectInput readInt
int readInt() throws IOException;
From source file:xbird.xquery.dm.value.sequence.MarshalledSequence.java
private static XQEventDecoder bulkIn(final ObjectInput input) throws IOException { final int inputLen = input.readInt(); final byte[] buf = new byte[inputLen]; input.readFully(buf);// w ww. jav a 2 s.c o m if (LOG.isDebugEnabled()) { LOG.debug("decoding sequence size: " + inputLen); } FastByteArrayInputStream inputBuf = new FastByteArrayInputStream(buf); ObjectInputStream objInput = new ObjectInputStream(inputBuf); XQEventDecoder decoder = new XQEventDecoder(objInput); return decoder; }
From source file:org.apache.axis2.context.externalize.MessageExternalizeUtils.java
/** * Read the Message//from w w w .j a v a 2 s .c o m * @param in * @param mc * @param correlationIDString * @return * @throws IOException */ public static SOAPEnvelope readExternal(ObjectInput in, MessageContext mc, String correlationIDString) throws IOException, ClassNotFoundException { if (log.isDebugEnabled()) { log.debug(correlationIDString + ":readExternal(): start"); } SOAPEnvelope envelope = null; // Read Prolog // Read the class name and object state String name = in.readUTF(); int revision = in.readInt(); if (log.isDebugEnabled()) { log.debug(correlationIDString + ":readExternal(): name= " + name + " revision= " + revision); } // make sure the object data is in a revision level we can handle if (revision != REVISION_2) { throw new ClassNotFoundException(ExternalizeConstants.UNSUPPORTED_REVID); } boolean gotMsg = in.readBoolean(); if (gotMsg != ACTIVE_OBJECT) { if (log.isDebugEnabled()) { log.debug(correlationIDString + ":readExternal(): end:" + "no message present"); } in.readInt(); // Read end of data blocks return envelope; } // Read optimized, optimized content-type, charset encoding and namespace uri boolean optimized = in.readBoolean(); String optimizedContentType = null; if (optimized) { optimizedContentType = in.readUTF(); } String charSetEnc = in.readUTF(); String namespaceURI = in.readUTF(); if (log.isDebugEnabled()) { log.debug(correlationIDString + ":readExternal(): " + "optimized=[" + optimized + "] " + "optimizedContentType=[" + optimizedContentType + "] " + "charSetEnc=[" + charSetEnc + "] " + "namespaceURI=[" + namespaceURI + "]"); } MessageInputStream mis = new MessageInputStream(in); StAXBuilder builder = null; try { if (optimized) { boolean isSOAP = true; builder = BuilderUtil.getAttachmentsBuilder(mc, mis, optimizedContentType, isSOAP); envelope = (SOAPEnvelope) builder.getDocumentElement(); envelope.buildWithAttachments(); } else { XMLStreamReader xmlreader = StAXUtils.createXMLStreamReader(mis, charSetEnc); builder = new StAXSOAPModelBuilder(xmlreader, namespaceURI); envelope = (SOAPEnvelope) builder.getDocumentElement(); envelope.build(); } } catch (Exception ex) { // TODO: what to do if can't get the XML stream reader // For now, log the event log.error(correlationIDString + ":readExternal(): Error when deserializing persisted envelope: [" + ex.getClass().getName() + " : " + ex.getLocalizedMessage() + "]", ex); envelope = null; } finally { if (builder != null) { builder.close(); } // Close the message input stream. This will ensure that the // underlying stream is advanced past the message. mis.close(); if (log.isDebugEnabled()) { log.debug(correlationIDString + ":readExternal(): end"); } } return envelope; }
From source file:org.codehaus.wadi.core.session.LazyAttributes.java
public synchronized void readExternal(ObjectInput oi) throws IOException, ClassNotFoundException { int length = oi.readInt(); bytes = new byte[length]; if (oi.read(bytes) != length) { throw new IOException("data truncated whilst reading Session Attributes- data lost"); }//from www. j ava2s.c o m }
From source file:com.delphix.session.impl.frame.SessionHandle.java
@Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { handle = new byte[in.readInt()]; in.read(handle);//from www.j a v a 2s .co m }
From source file:MainClass.java
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { System.out.println("MyBean.readExternal"); s = (String) in.readObject(); i = in.readInt(); }
From source file:com.delphix.session.impl.frame.ExchangeID.java
@Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { xid = in.readInt(); }
From source file:org.codehaus.wadi.core.session.LazyValue.java
public synchronized void readExternal(ObjectInput oi) throws IOException, ClassNotFoundException { int length = oi.readInt(); bytes = new byte[length]; if (oi.read(bytes) != length) { throw new IOException("data truncated whilst reading Session attribute value - data lost"); }/* ww w . j a va 2 s . c o m*/ }
From source file:com.enonic.cms.core.portal.instruction.PostProcessInstruction.java
protected String[] readStringArray(ObjectInput in) throws IOException { String[] array = new String[in.readInt()]; for (int i = 0; i < array.length; i++) { array[i] = in.readUTF();//from w ww. j a v a 2 s . c o m } return array; }
From source file:org.wso2.carbon.ml.core.spark.models.MLMatrixFactorizationModel.java
@SuppressWarnings("unchecked") @Override// w w w.j ava 2s.c o m public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { int rank = in.readInt(); List<Tuple2<Object, double[]>> userFeaturesList = (List<Tuple2<Object, double[]>>) in.readObject(); List<Tuple2<Object, double[]>> productFeaturesList = (List<Tuple2<Object, double[]>>) in.readObject(); MLCoreServiceValueHolder valueHolder = MLCoreServiceValueHolder.getInstance(); RDD<Tuple2<Object, double[]>> userFeatures = valueHolder.getSparkContext().parallelize(userFeaturesList) .rdd(); RDD<Tuple2<Object, double[]>> productFeatures = valueHolder.getSparkContext() .parallelize(productFeaturesList).rdd(); model = new MatrixFactorizationModel(rank, userFeatures, productFeatures); if (log.isDebugEnabled()) { log.debug("Rank, user features and product features were de-serialized successfully and loaded " + "MatrixFactorizationModel."); } }
From source file:gridool.dht.ops.DropOperation.java
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { final int len = in.readInt(); final String[] idxNames = new String[len]; for (int i = 0; i < len; i++) { idxNames[i] = IOUtils.readString(in); }/* w w w .j a va 2s .c om*/ this.idxNames = idxNames; this.async = in.readBoolean(); }