public void sendTo(DataOutput out) throws IOException { this.hdos.sendTo(out); }
public void sendTo(DataOutput out) throws IOException { this.hdos.sendTo(out); }
/** * Write the contents of this stream to the specified stream using * outBuf if a buffer is needed. */ public final void sendTo(OutputStream out, ByteBuffer outBuf) throws IOException { finishWriting(); if (this.chunks != null) { for (ByteBuffer bb: this.chunks) { sendTo(out, outBuf, bb); } } sendTo(out, outBuf, this.buffer); flushStream(out, outBuf); }
@Override public void toData(DataOutput out) throws IOException { super.toData(out); if (this.chunkStream == null) { out.writeInt(-1); } else { out.writeInt(this.numObjects); } out.writeInt(this.msgNum); out.writeBoolean(this.lastMsg); out.writeBoolean(this.pdxReadSerialized); if (this.chunkStream != null && this.numObjects > 0) { this.chunkStream.sendTo(out); } }
@Override public void toData(DataOutput out) throws IOException { super.toData(out); if (this.chunkStream == null) { out.writeInt(-1); } else { out.writeInt(this.numObjects); } out.writeInt(this.msgNum); out.writeBoolean(this.lastMsg); out.writeBoolean(this.pdxReadSerialized); if (this.chunkStream != null && this.numObjects > 0) { this.chunkStream.sendTo(out); } }
/** * Write the contents of this part to the specified byte buffer. */ public final void sendTo(ByteBuffer buf) { if (getLength() > 0) { if (this.part instanceof byte[]) { buf.put((byte[])this.part); } else { HeapDataOutputStream hdos = (HeapDataOutputStream)this.part; hdos.sendTo(buf); hdos.rewind(); } } } /**
/** * Write the contents of this part to the specified output stream. */ public final void sendTo(OutputStream out) throws IOException { if (getLength() > 0) { if (this.part instanceof byte[]) { byte[] bytes = (byte[])this.part; out.write(bytes, 0, bytes.length); } else { HeapDataOutputStream hdos = (HeapDataOutputStream)this.part; hdos.sendTo(out); hdos.rewind(); } } } /**
hdos.sendTo(sc, buf); hdos.rewind();
public void toData(DataOutput out) throws IOException { if (this.preserializedBuffer != null) { this.preserializedBuffer.rewind(); this.preserializedBuffer.sendTo(out); } else if (this.refCount > 1) { Version v = InternalDataSerializer.getVersionForDataStream(out); HeapDataOutputStream hdos = new HeapDataOutputStream(1024, v); basicToData(hdos); this.preserializedBuffer = hdos; this.preserializedBuffer.sendTo(out); } else { basicToData(out); } } /**
private void writeIFRecord(HeapDataOutputStream hdos, boolean doStats) throws IOException { assert lock.isHeldByCurrentThread(); if (this.closed) { throw new DiskAccessException("The disk store is closed", parent); } hdos.sendTo(this.ifRAF); if (logger.isTraceEnabled(LogMarker.PERSIST_WRITES)) { logger.trace(LogMarker.PERSIST_WRITES, "DiskInitFile writeIFRecord HDOS"); } if (doStats) { this.ifLiveRecordCount++; this.ifTotalRecordCount++; } compactIfNeeded(); }
hdos.sendTo(buf); hdos.rewind();
/** * Writes the given object to this stream as a byte array. * The byte array is produced by serializing v. The serialization * is done by calling DataSerializer.writeObject. */ public void writeAsSerializedByteArray(Object v) throws IOException { if (this.ignoreWrites) return; checkIfWritable(); ensureCapacity(5); if (v instanceof HeapDataOutputStream) { HeapDataOutputStream other = (HeapDataOutputStream)v; InternalDataSerializer.writeArrayLength(other.size(), this); other.sendTo((OutputStream)this); other.rewind(); } else { ByteBuffer sizeBuf = this.buffer; int sizePos = sizeBuf.position(); sizeBuf.position(sizePos+5); final int preArraySize = size(); DataSerializer.writeObject(v, this); int arraySize = size() - preArraySize; sizeBuf.put(sizePos, InternalDataSerializer.INT_ARRAY_LEN); sizeBuf.putInt(sizePos+1, arraySize); } }
private void writeIFRecord(HeapDataOutputStream hdos, boolean doStats) throws IOException { assert lock.isHeldByCurrentThread(); if (this.closed) { throw new DiskAccessException("The disk store is closed", parent); } hdos.sendTo(this.ifRAF); if (DiskStoreImpl.TRACE_WRITES) { getLogger().info(LocalizedStrings.DEBUG, "TRACE_WRITES: DiskInitFile writeIFRecord HDOS" // , new RuntimeException("STACK") ); } if (doStats) { this.ifLiveRecordCount++; this.ifTotalRecordCount++; } compactIfNeeded(); }
hdos.sendTo(out, buf); hdos.rewind();
other.sendTo((ByteBufferWriter)this); other.rewind();
/** * @exception StandardException thrown on failure to convert */ public byte[] getBytes() throws StandardException { // GemStone changes BEGIN if (!isNull()) { HeapDataOutputStream hdos = new HeapDataOutputStream(); try { toDataForOptimizedResultHolder(hdos); } catch (IOException ioe) { throw GemFireXDRuntimeException.newRuntimeException( "Exception in UserType.getBytes.", ioe); } byte[] buffer = new byte[hdos.size()]; hdos.sendTo(buffer, 0); return buffer; } return null; /* (original code) if (! isNull()) if (value instanceof byte[]) return ((byte[])value); return super.getBytes(); */ // GemStone changes END }
/** * @exception StandardException thrown on failure to convert */ public byte[] getBytes() throws StandardException { // GemStone changes BEGIN if (!isNull()) { HeapDataOutputStream hdos = new HeapDataOutputStream(); try { toDataForOptimizedResultHolder(hdos); } catch (IOException ioe) { throw GemFireXDRuntimeException.newRuntimeException( "Exception in UserType.getBytes.", ioe); } byte[] buffer = new byte[hdos.size()]; hdos.sendTo(buffer, 0); return buffer; } return null; /* (original code) if (! isNull()) if (value instanceof byte[]) return ((byte[])value); return super.getBytes(); */ // GemStone changes END }
/** * @exception StandardException thrown on failure to convert */ public byte[] getBytes() throws StandardException { // GemStone changes BEGIN if (!isNull()) { HeapDataOutputStream hdos = new HeapDataOutputStream(); try { toDataForOptimizedResultHolder(hdos); } catch (IOException ioe) { throw GemFireXDRuntimeException.newRuntimeException( "Exception in UserType.getBytes.", ioe); } byte[] buffer = new byte[hdos.size()]; hdos.sendTo(buffer, 0); return buffer; } return null; /* (original code) if (! isNull()) if (value instanceof byte[]) return ((byte[])value); return super.getBytes(); */ // GemStone changes END }
@Override public void toData(DataOutput out) throws IOException { boolean isStruct = this.collectionType.getElementType().isStructType(); DataSerializer.writeObject(this.collectionType.getElementType(), out); HeapDataOutputStream hdos = new HeapDataOutputStream(1024, null); LongUpdater lu = hdos.reserveLong(); Iterator<E> iter = this.iterator(); int numElements = 0; while (iter.hasNext()) { E data = iter.next(); if (isStruct) { Object[] fields = ((Struct) data).getFieldValues(); DataSerializer.writeObjectArray(fields, out); } else { DataSerializer.writeObject(data, hdos); } ++numElements; } lu.update(numElements); hdos.sendTo(out); }
@Override public void toData(DataOutput out) throws IOException { boolean isStruct = this.collectionType.getElementType().isStructType(); DataSerializer.writeObject(this.collectionType.getElementType(), out); DataSerializer.writePrimitiveBoolean(this.isDistinct, out); HeapDataOutputStream hdos = new HeapDataOutputStream(1024, null); LongUpdater lu = hdos.reserveLong(); Iterator<E> iter = this.iterator(); int numElements = 0; while (iter.hasNext()) { E data = iter.next(); if(isStruct) { Object[] fields = ((Struct)data).getFieldValues(); DataSerializer.writeObjectArray(fields, out); }else { DataSerializer.writeObject(data, hdos); } ++numElements; } lu.update(numElements); hdos.sendTo(out); }