List of usage examples for java.io ObjectInput readFully
void readFully(byte b[]) throws IOException;
From source file:gov.nih.nci.caarray.external.v1_0.data.AbstractDataColumn.java
/** * Optimizes the serialized form of this class by compressing the values array. * /*from w w w .ja va 2 s. c o m*/ * {@inheritDoc} */ public void readExternal(ObjectInput oi) throws IOException, ClassNotFoundException { this.quantitationType = (QuantitationType) oi.readObject(); int valuesLength = oi.readInt(); byte[] serializedValues = new byte[valuesLength]; oi.readFully(serializedValues); setSerializableValues(CaArrayUtils.deserialize(serializedValues)); }
From source file:com.splicemachine.derby.stream.compaction.SparkCompactionFunction.java
@Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { super.readExternal(in); smallestReadPoint = in.readLong();/* w ww .j av a 2 s . c o m*/ namespace = new byte[in.readInt()]; in.readFully(namespace); tableName = new byte[in.readInt()]; in.readFully(tableName); byte[] hriBytes = new byte[in.readInt()]; in.readFully(hriBytes); try { hri = HRegionInfo.parseFrom(hriBytes); } catch (Exception e) { throw new IOException(e); } storeColumn = new byte[in.readInt()]; in.readFully(storeColumn); SpliceSpark.setupSpliceStaticComponents(); }
From source file:com.talis.storage.s3.ExternalizableS3Object.java
@Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { this.setKey(in.readUTF()); this.setBucketName(in.readUTF()); this.setAcl((AccessControlList) in.readObject()); this.setMetadataComplete(in.readBoolean()); this.addAllMetadata((Map) in.readObject()); int length = in.readInt(); byte[] entity = new byte[length]; in.readFully(entity); this.setDataInputStream(new ByteArrayInputStream(entity)); }
From source file:com.ning.metrics.serialization.event.SmileEnvelopeEvent.java
/** * The object implements the readExternal method to restore its * contents by calling the methods of DataInput for primitive * types and readObject for objects, strings and arrays. The * readExternal method must read the values in the same sequence * and with the same types as were written by writeExternal. * * @param in the stream to read data from in order to restore the object * @throws java.io.IOException if I/O errors occur *//*from w w w . j a v a2s. c o m*/ @Override public void readExternal(final ObjectInput in) throws IOException { // Name of the event first final int smileEventNameBytesSize = in.readInt(); final byte[] eventNameBytes = new byte[smileEventNameBytesSize]; in.readFully(eventNameBytes); eventName = new String(eventNameBytes, NAME_CHARSET); // Then payload final int smilePayloadSize = in.readInt(); final byte[] smilePayload = new byte[smilePayloadSize]; in.readFully(smilePayload); root = parseAsTree(smilePayload); setEventPropertiesFromNode(root); }
From source file:com.px100systems.util.serialization.SerializationDefinition.java
/** * Externalizable helper - should be used in Externalizable implementations. * @param in input// www .j av a 2 s. c o m * @param bean bean */ public void read(ObjectInput in, Object bean) { DataStream ds = null; try { int length = in.readInt(); byte[] data = new byte[length]; in.readFully(data); ds = new DataStream(data); read(ds, bean); } catch (IOException e) { throw new RuntimeException(e); } finally { if (ds != null) ds.close(); } }
From source file:com.splicemachine.derby.stream.function.RowAndIndexGenerator.java
@Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { heapConglom = in.readLong();/*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(); 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:org.taverna.server.master.common.Workflow.java
@Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { try {/*from w ww . j av a 2s . c o m*/ int len = in.readInt(); byte[] bytes = new byte[len]; in.readFully(bytes); Reader r = new InputStreamReader(new InflaterInputStream(new ByteArrayInputStream(bytes)), ENCODING); Workflow w = (Workflow) unmarshaller.unmarshal(r); r.close(); this.content = w.content; return; } catch (JAXBException e) { throw new IOException("failed to unmarshal", e); } catch (ClassCastException e) { throw new IOException("bizarre result of unmarshalling", e); } }
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); if (LOG.isDebugEnabled()) { LOG.debug("decoding sequence size: " + inputLen); }//from w ww . j av a 2s . c o m FastByteArrayInputStream inputBuf = new FastByteArrayInputStream(buf); ObjectInputStream objInput = new ObjectInputStream(inputBuf); XQEventDecoder decoder = new XQEventDecoder(objInput); return decoder; }