List of usage examples for java.io ObjectInput readInt
int readInt() throws IOException;
From source file:org.perf.log.logger.PerfLogData.java
private String readStr(ObjectInput in) { // read length try {// w ww . j ava 2s .c o m int len = in.readInt(); if (len == 0) return null; else return (String) in.readObject(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); return null; } catch (ClassNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); return null; } }
From source file:org.t2framework.commons.util.ArrayMap.java
@SuppressWarnings("unchecked") public final void readExternal(final ObjectInput in) throws IOException, ClassNotFoundException {//from w w w .ja va 2 s . c om int num = in.readInt(); mapTable = new Entry[num]; listTable = new Entry[num]; threshold = (int) (num * LOAD_FACTOR); int size = in.readInt(); for (int i = 0; i < size; i++) { K key = (K) in.readObject(); V value = (V) in.readObject(); put(key, value); } }
From source file:com.splicemachine.derby.stream.function.RowAndIndexGenerator.java
@Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { heapConglom = in.readLong();//from ww w. ja v a 2 s. c o m if (in.readBoolean()) operationContext = (OperationContext) in.readObject(); txn = SIDriver.driver().getOperationFactory().readTxn(in); pkCols = ArrayUtil.readIntArray(in); tableVersion = in.readUTF(); execRowDefinition = (ExecRow) in.readObject(); autoIncrementRowLocationArray = new RowLocation[in.readInt()]; for (int i = 0; i < autoIncrementRowLocationArray.length; i++) autoIncrementRowLocationArray[i] = (RowLocation) in.readObject(); spliceSequences = new SpliceSequence[in.readInt()]; for (int i = 0; i < spliceSequences.length; i++) spliceSequences[i] = (SpliceSequence) in.readObject(); heapConglom = in.readLong(); int iSize = in.readInt(); tentativeIndices = new ArrayList<>(iSize); for (int i = 0; i < iSize; i++) { byte[] message = new byte[in.readInt()]; in.readFully(message); tentativeIndices.add(DDLMessage.TentativeIndex.parseFrom(message)); } }
From source file:com.splicemachine.derby.stream.output.insert.InsertTableWriterBuilder.java
@Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { isUpsert = in.readBoolean();/*from w ww .j a va 2 s .c o m*/ if (in.readBoolean()) operationContext = (OperationContext) in.readObject(); txn = SIDriver.driver().getOperationFactory().readTxn(in); pkCols = ArrayUtil.readIntArray(in); tableVersion = in.readUTF(); execRowTypeFormatIds = ArrayUtil.readIntArray(in); execRowDefinition = (ExecRow) in.readObject(); autoIncrementRowLocationArray = new RowLocation[in.readInt()]; for (int i = 0; i < autoIncrementRowLocationArray.length; i++) autoIncrementRowLocationArray[i] = (RowLocation) in.readObject(); spliceSequences = new SpliceSequence[in.readInt()]; for (int i = 0; i < spliceSequences.length; i++) spliceSequences[i] = (SpliceSequence) in.readObject(); heapConglom = in.readLong(); }
From source file:org.knime.al.util.noveltydetection.knfst.KNFST.java
@Override public void readExternal(final ObjectInput arg0) throws IOException, ClassNotFoundException { try {/*from w ww. j a v a 2s .c o m*/ // read kernel m_kernel = (KernelCalculator) Class.forName(arg0.readUTF()).newInstance(); m_kernel.readExternal(arg0); // read projection // rows final int rowsProj = arg0.readInt(); // columns final int colsProj = arg0.readInt(); // data final double[][] projData = new double[rowsProj][colsProj]; for (int r = 0; r < rowsProj; r++) { for (int c = 0; c < colsProj; c++) { projData[r][c] = arg0.readDouble(); } } // Matrix construction m_projection = MatrixUtils.createRealMatrix(projData); // read targetPoints // rows final int rowsTar = arg0.readInt(); // columns final int colsTar = arg0.readInt(); // data final double[][] tarData = new double[rowsTar][colsTar]; for (int r = 0; r < rowsTar; r++) { for (int c = 0; c < colsTar; c++) { tarData[r][c] = arg0.readDouble(); } } // Matrix construction m_targetPoints = MatrixUtils.createRealMatrix(tarData); // read betweenClassDistances final double[] betweenClassDistances = new double[arg0.readInt()]; for (int i = 0; i < betweenClassDistances.length; i++) { betweenClassDistances[i] = arg0.readDouble(); } m_betweenClassDistances = betweenClassDistances; } catch (InstantiationException | IllegalAccessException e) { throw new IOException(e); } }
From source file:org.apache.shindig.gadgets.http.HttpResponse.java
/** * Expected layout:/*from w ww. j ava2 s .c o m*/ * * int - status code * Map<String, List<String>> - headers * int - length of body * byte array - body, of previously specified length */ @SuppressWarnings("unchecked") public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { httpStatusCode = in.readInt(); // We store the multimap as a Map<String,List<String>> to insulate us from google-collections API churn // And to remain backwards compatible Map<String, List<String>> headerCopyMap = (Map<String, List<String>>) in.readObject(); Multimap headerCopy = newHeaderMultimap(); for (Map.Entry<String, List<String>> entry : headerCopyMap.entrySet()) { headerCopy.putAll(entry.getKey(), entry.getValue()); } int bodyLength = in.readInt(); responseBytes = new byte[bodyLength]; int cnt, offset = 0; while ((cnt = in.read(responseBytes, offset, bodyLength)) > 0) { offset += cnt; bodyLength -= cnt; } if (offset != responseBytes.length) { throw new IOException( "Invalid body! Expected length = " + responseBytes.length + ", bytes readed = " + offset + '.'); } date = getAndUpdateDate(headerCopy); encoding = getAndUpdateEncoding(headerCopy, responseBytes); headers = Multimaps.unmodifiableMultimap(headerCopy); metadata = Collections.emptyMap(); }
From source file:org.knime.al.util.noveltydetection.kernel.KernelCalculator.java
/************ Externalizable methods *****************/ @Override/*from ww w .ja va 2 s. co m*/ public void readExternal(final ObjectInput in) throws IOException, ClassNotFoundException { try { // read kernelFunction m_kernelFunction = (KernelFunction) Class.forName(in.readUTF()).newInstance(); m_kernelFunction.readExternal(in); // read trainingData // rows m_rowCount = in.readInt(); // columns m_colCount = in.readInt(); // data m_trainingData = new double[m_rowCount][m_colCount]; for (int r = 0; r < m_rowCount; r++) { for (int c = 0; c < m_colCount; c++) { m_trainingData[r][c] = in.readDouble(); } } } catch (InstantiationException | IllegalAccessException e) { throw new IOException(e); } }
From source file:com.inmobi.grill.driver.hive.HiveDriver.java
@Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { synchronized (hiveHandles) { int numHiveHnadles = in.readInt(); for (int i = 0; i < numHiveHnadles; i++) { QueryHandle qhandle = (QueryHandle) in.readObject(); OperationHandle opHandle = new OperationHandle((TOperationHandle) in.readObject()); hiveHandles.put(qhandle, opHandle); LOG.debug("Hive driver recovered " + qhandle + ":" + opHandle); }//w ww.ja v a2 s. c o m LOG.info("HiveDriver recovered " + hiveHandles.size() + " queries"); int numSessions = in.readInt(); for (int i = 0; i < numSessions; i++) { String grillId = in.readUTF(); SessionHandle sHandle = new SessionHandle((TSessionHandle) in.readObject(), TProtocolVersion.HIVE_CLI_SERVICE_PROTOCOL_V6); grillToHiveSession.put(grillId, sHandle); } LOG.info("HiveDriver recovered " + grillToHiveSession.size() + " sessions"); } }
From source file:TransferableScribblePane.java
public void readExternal(java.io.ObjectInput in) throws java.io.IOException, ClassNotFoundException { this.x0 = in.readFloat(); this.y0 = in.readFloat(); this.numsegs = in.readInt(); this.coords = new float[numsegs * 2]; for (int i = 0; i < numsegs * 2; i++) coords[i] = in.readFloat();// w w w .j a v a 2 s . c o m }
From source file:com.conwet.silbops.model.Subscription.java
@Override public void readExternal(ObjectInput input) throws IOException, ClassNotFoundException { id = (String) input.readObject(); contextFunction = (ContextFunction) input.readObject(); // read the map content int keySize = input.readInt(); Map<Attribute, Set<Constraint>> map = new HashMap<>(); for (int i = 0; i < keySize; i++) { Attribute attribute = attributeExt.readExternal(input); int constSize = input.readInt(); Set<Constraint> constrSet = new HashSet<>(); for (int j = 0; j < constSize; j++) { constrSet.add(constraintExt.readExternal(input, attribute.getType())); }//from w w w. ja v a2s. com map.put(attribute, constrSet); } constraints = map; }