com.intellij.util.io.DataInputOutputUtil Java Examples

The following examples show how to use com.intellij.util.io.DataInputOutputUtil. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Unity3dYMLAssetIndexExtension.java    From consulo-unity3d with Apache License 2.0 6 votes vote down vote up
@Override
public List<Unity3dYMLAsset> read(DataInput dataInput) throws IOException
{
	return DataInputOutputUtil.readSeq(dataInput, () ->
	{
		String guid = dataInput.readUTF();
		int startOffset = dataInput.readInt();
		boolean gameObjectCheck = dataInput.readBoolean();
		String gameObjectName = null;
		if(gameObjectCheck)
		{
			gameObjectName = dataInput.readUTF();
		}
		List<Unity3dYMLField> values = DataInputOutputUtil.readSeq(dataInput, () ->
		{
			String name = dataInput.readUTF();
			String value = dataInput.readUTF();
			int offset = dataInput.readInt();
			return new Unity3dYMLField(name, value, offset);
		});
		return new Unity3dYMLAsset(guid, gameObjectName, startOffset, values);
	});
}
 
Example #2
Source File: DuplicatesIndex.java    From consulo with Apache License 2.0 6 votes vote down vote up
@Override
public void save(@Nonnull DataOutput out, TIntArrayList list) throws IOException {
  if (list.size() == 2) {
    DataInputOutputUtil.writeINT(out, list.getQuick(0));
    DataInputOutputUtil.writeINT(out, list.getQuick(1));
  }
  else {
    DataInputOutputUtil.writeINT(out, -list.size());
    int prev = 0;
    for (int i = 0, len = list.size(); i < len; i+=2) {
      int value = list.getQuick(i);
      DataInputOutputUtil.writeINT(out, value - prev);
      prev = value;
      DataInputOutputUtil.writeINT(out, list.getQuick(i + 1));
    }
  }
}
 
Example #3
Source File: VirtualFileGistImpl.java    From consulo with Apache License 2.0 6 votes vote down vote up
@Override
public Data getFileData(@Nullable Project project, @Nonnull VirtualFile file) {
  ApplicationManager.getApplication().assertReadAccessAllowed();
  ProgressManager.checkCanceled();

  if (!(file instanceof VirtualFileWithId)) return myCalculator.calcData(project, file);

  int stamp = PersistentFS.getInstance().getModificationCount(file) + ((GistManagerImpl)GistManager.getInstance()).getReindexCount();

  try (DataInputStream stream = getFileAttribute(project).readAttribute(file)) {
    if (stream != null && DataInputOutputUtil.readINT(stream) == stamp) {
      return stream.readBoolean() ? myExternalizer.read(stream) : null;
    }
  }
  catch (IOException e) {
    LOG.error(e);
  }

  Data result = myCalculator.calcData(project, file);
  cacheResult(stamp, result, project, file);
  return result;
}
 
Example #4
Source File: IntEnumerator.java    From consulo with Apache License 2.0 6 votes vote down vote up
void dump(DataOutputStream stream, IntUnaryOperator idRemapping) throws IOException {
  DataInputOutputUtil.writeINT(stream, myIds.size());
  IOException[] exception = new IOException[1];
  myIds.forEach(id -> {
    try {
      int remapped = idRemapping.applyAsInt(id);
      if (remapped == 0) {
        exception[0] = new IOException("remapping is not found for " + id);
        return false;
      }
      DataInputOutputUtil.writeINT(stream, remapped);
    }
    catch (IOException e) {
      exception[0] = e;
      return false;
    }
    return true;
  });
  if (exception[0] != null) {
    throw exception[0];
  }
}
 
Example #5
Source File: StubSerializationHelper.java    From consulo with Apache License 2.0 6 votes vote down vote up
private void deserializeChildren(StubInputStream stream, Stub parent, IntEnumerator serializerLocalEnumerator) throws IOException, SerializerNotFoundException {
  int childCount = DataInputOutputUtil.readINT(stream);
  for (int i = 0; i < childCount; i++) {
    boolean dangling = false;
    int id = DataInputOutputUtil.readINT(stream);
    if (id == 0) {
      dangling = true;
      id = DataInputOutputUtil.readINT(stream);
    }

    Stub child = getClassById(id, parent, serializerLocalEnumerator).deserialize(stream, parent);
    if (dangling) {
      ((ObjectStubBase)child).markDangling();
    }
    deserializeChildren(stream, child, serializerLocalEnumerator);
  }
}
 
Example #6
Source File: StubSerializationHelper.java    From consulo with Apache License 2.0 6 votes vote down vote up
private void serializeStubList(StubList stubList, DataOutput out, AbstractStringEnumerator storage, IntEnumerator serializerLocalEnumerator) throws IOException {
  if (!stubList.isChildrenLayoutOptimal()) {
    throw new IllegalArgumentException("Manually assembled stubs should be normalized before serialization, consider wrapping them into StubTree");
  }

  DataInputOutputUtil.writeINT(out, stubList.size());
  DataInputOutputUtil.writeINT(out, stubList.getChildrenCount(0));

  BufferExposingByteArrayOutputStream tempBuffer = new BufferExposingByteArrayOutputStream();
  ByteArrayInterner interner = new ByteArrayInterner();

  for (int i = 1; i < stubList.size(); i++) {
    StubBase<?> stub = stubList.get(i);
    ObjectStubSerializer<Stub, Stub> serializer = writeSerializerId(stub, out, serializerLocalEnumerator);
    DataInputOutputUtil.writeINT(out, interner.internBytes(serializeStub(serializer, storage, stub, tempBuffer)));
    DataInputOutputUtil.writeINT(out, stubList.getChildrenCount(stub.id));
  }

  writeByteArray(out, interner.joinedBuffer.getInternalBuffer(), interner.joinedBuffer.size());
}
 
Example #7
Source File: StubSerializationHelper.java    From consulo with Apache License 2.0 6 votes vote down vote up
private Stub deserializeRoot(StubInputStream inputStream, FileLocalStringEnumerator storage, IntEnumerator serializerLocalEnumerator) throws IOException, SerializerNotFoundException {
  ObjectStubSerializer<?, Stub> serializer = getClassById(DataInputOutputUtil.readINT(inputStream), null, serializerLocalEnumerator);
  ourRootStubSerializer.set(serializer);
  try {
    Stub stub = serializer.deserialize(inputStream, null);
    if (stub instanceof StubBase) {
      deserializeStubList((StubBase)stub, serializer, inputStream, storage, serializerLocalEnumerator);
    }
    else {
      deserializeChildren(inputStream, stub, serializerLocalEnumerator);
    }
    return stub;
  }
  finally {
    ourRootStubSerializer.set(null);
  }
}
 
Example #8
Source File: StubUpdatingIndex.java    From consulo with Apache License 2.0 6 votes vote down vote up
private static void rememberIndexingStamp(@Nonnull VirtualFile file, boolean isBinary, long contentByteLength, int contentCharLength) {
  try (DataOutputStream stream = INDEXED_STAMP.writeAttribute(file)) {
    DataInputOutputUtil.writeTIME(stream, file.getTimeStamp());
    DataInputOutputUtil.writeLONG(stream, contentByteLength);

    boolean lengthsAreTheSame = contentByteLength == contentCharLength;
    byte flags = 0;
    flags = BitUtil.set(flags, IS_BINARY_MASK, isBinary);
    flags = BitUtil.set(flags, BYTE_AND_CHAR_LENGTHS_ARE_THE_SAME_MASK, lengthsAreTheSame);
    stream.writeByte(flags);

    if (!lengthsAreTheSame && !isBinary) {
      DataInputOutputUtil.writeINT(stream, contentCharLength);
    }
  }
  catch (IOException e) {
    LOG.error(e);
  }
}
 
Example #9
Source File: ChangeTrackingValueContainer.java    From consulo with Apache License 2.0 6 votes vote down vote up
@Override
public void saveTo(DataOutput out, DataExternalizer<? super Value> externalizer) throws IOException {
  if (needsCompacting()) {
    getMergedData().saveTo(out, externalizer);
  }
  else {
    final TIntHashSet set = myInvalidated;
    if (set != null && set.size() > 0) {
      for (int inputId : set.toArray()) {
        DataInputOutputUtil.writeINT(out, -inputId); // mark inputId as invalid, to be processed on load in ValueContainerImpl.readFrom
      }
    }

    final UpdatableValueContainer<Value> toAppend = myAdded;
    if (toAppend != null && toAppend.size() > 0) {
      toAppend.saveTo(out, externalizer);
    }
  }
}
 
Example #10
Source File: CompressionUtil.java    From consulo with Apache License 2.0 6 votes vote down vote up
@Nonnull
public static CharSequence uncompressStringRawBytes(@Nonnull Object compressed) {
  if (compressed instanceof CharSequence) return (CharSequence)compressed;

  ByteBuffer buffer = ByteBuffer.wrap((byte[])compressed);
  int len = DataInputOutputUtil.readINT(buffer);
  int uncompressedLength = DataInputOutputUtil.readINT(buffer) + len;

  ByteBuffer dest = ByteBuffer.wrap(spareBufferLocal.getBuffer(uncompressedLength), 0, uncompressedLength);
  decompressor().decompress(buffer, dest);
  dest.rewind();

  char[] chars = new char[len];

  for (int i = 0; i < len; i++) {
    int c = DataInputOutputUtil.readINT(dest);
    chars[i] = (char)c;
  }
  return StringFactory.createShared(chars);
}
 
Example #11
Source File: CompressionUtil.java    From consulo with Apache License 2.0 6 votes vote down vote up
@Nonnull
public static byte[] readCompressedWithoutOriginalBufferLength(@Nonnull DataInput in, int originalBufferLength) throws IOException {
  int size = DataInputOutputUtil.readINT(in);

  byte[] bytes = spareBufferLocal.getBuffer(size);
  in.readFully(bytes, 0, size);

  int decompressedRequests = myDecompressionRequests.incrementAndGet();
  long started = DUMP_COMPRESSION_STATS ? System.nanoTime() : 0;

  final byte[] decompressedResult = decompressor().decompress(bytes, 0, originalBufferLength);

  long doneTime = (DUMP_COMPRESSION_STATS ? System.nanoTime() : 0) - started;
  long decompressedSize = myDecompressedSize.addAndGet(size);
  long decompressedTime = myDecompressionTime.addAndGet(doneTime);
  if (DUMP_COMPRESSION_STATS && (decompressedRequests & 0x1fff) == 0) {
    System.out.println("Decompressed " + decompressedRequests + " times, size: " + decompressedSize + " for " + (decompressedTime / 1000000) + "ms");
  }

  return decompressedResult;
}
 
Example #12
Source File: CompressionUtil.java    From consulo with Apache License 2.0 6 votes vote down vote up
public static int writeCompressedWithoutOriginalBufferLength(@Nonnull DataOutput out, @Nonnull byte[] bytes, int length) throws IOException {
  long started = DUMP_COMPRESSION_STATS ? System.nanoTime() : 0;

  LZ4Compressor compressor = compressor();
  final byte[] compressedOutputBuffer = spareBufferLocal.getBuffer(compressor.maxCompressedLength(length));
  int compressedSize = compressor.compress(bytes, 0, length, compressedOutputBuffer, 0);

  final long time = (DUMP_COMPRESSION_STATS ? System.nanoTime() : 0) - started;
  mySizeAfterCompression.addAndGet(compressedSize);
  mySizeBeforeCompression.addAndGet(length);
  int requests = myCompressionRequests.incrementAndGet();
  long l = myCompressionTime.addAndGet(time);

  if (DUMP_COMPRESSION_STATS && (requests & 0x1fff) == 0) {
    System.out.println("Compressed " + requests + " times, size:" + mySizeBeforeCompression + "->" + mySizeAfterCompression + " for " + (l / 1000000) + "ms");
  }

  DataInputOutputUtil.writeINT(out, compressedSize);
  out.write(compressedOutputBuffer, 0, compressedSize);

  return compressedSize;
}
 
Example #13
Source File: VfsDependentEnum.java    From consulo with Apache License 2.0 6 votes vote down vote up
private void saveToFile(@Nonnull T instance) throws IOException {
  FileOutputStream fileOutputStream = new FileOutputStream(myFile, true);

  try (DataOutputStream output = new DataOutputStream(new BufferedOutputStream(fileOutputStream))) {
    if (myFile.length() == 0) {
      DataInputOutputUtil.writeTIME(output, FSRecords.getCreationTimestamp());
      DataInputOutputUtil.writeINT(output, myVersion);
    }
    myKeyDescriptor.save(output, instance);
  }
  finally {
    try {
      fileOutputStream.getFD().sync();
    }
    catch (IOException ignored) {
    }
  }
}
 
Example #14
Source File: Unity3dYMLAssetIndexExtension.java    From consulo-unity3d with Apache License 2.0 6 votes vote down vote up
@Override
public void save(DataOutput dataOutput, List<Unity3dYMLAsset> list) throws IOException
{
	DataInputOutputUtil.writeSeq(dataOutput, list, asset ->
	{
		dataOutput.writeUTF(asset.getGuild());
		dataOutput.writeInt(asset.getStartOffset());
		String gameObjectName = asset.getGameObjectName();
		dataOutput.writeBoolean(gameObjectName != null);
		if(gameObjectName != null)
		{
			dataOutput.writeUTF(gameObjectName);
		}

		DataInputOutputUtil.writeSeq(dataOutput, asset.getValues(), it ->
		{
			dataOutput.writeUTF(it.getName());
			dataOutput.writeUTF(it.getValue());
			dataOutput.writeInt(it.getOffset());
		});
	});
}
 
Example #15
Source File: CompressionUtil.java    From consulo with Apache License 2.0 6 votes vote down vote up
public static int writeCompressed(@Nonnull DataOutput out, @Nonnull byte[] bytes, int start, int length) throws IOException {
  if (length > COMPRESSION_THRESHOLD) {
    LZ4Compressor compressor = compressor();

    byte[] compressedOutputBuffer = spareBufferLocal.getBuffer(compressor.maxCompressedLength(length));
    int compressedSize = compressor.compress(bytes, start, length, compressedOutputBuffer, 0);
    if (compressedSize < length) {
      DataInputOutputUtil.writeINT(out, -compressedSize);
      DataInputOutputUtil.writeINT(out, length - compressedSize);
      out.write(compressedOutputBuffer, 0, compressedSize);
      return compressedSize;
    }
  }
  DataInputOutputUtil.writeINT(out, length);
  out.write(bytes, start, length);
  return length;
}
 
Example #16
Source File: FileLocalStringEnumerator.java    From consulo with Apache License 2.0 5 votes vote down vote up
static void readEnumeratedStrings(@Nonnull FileLocalStringEnumerator enumerator, @Nonnull DataInput stream, @Nonnull UnaryOperator<String> interner) throws IOException {
  final int numberOfStrings = DataInputOutputUtil.readINT(stream);
  byte[] buffer = IOUtil.allocReadWriteUTFBuffer();
  enumerator.myStrings.ensureCapacity(numberOfStrings);

  int i = 0;
  while (i < numberOfStrings) {
    String s = interner.apply(IOUtil.readUTFFast(buffer, stream));
    enumerator.myStrings.add(s);
    ++i;
  }
}
 
Example #17
Source File: VirtualFileGistImpl.java    From consulo with Apache License 2.0 5 votes vote down vote up
private void cacheResult(int modCount, @Nullable Data result, Project project, VirtualFile file) {
  try (DataOutputStream out = getFileAttribute(project).writeAttribute(file)) {
    DataInputOutputUtil.writeINT(out, modCount);
    out.writeBoolean(result != null);
    if (result != null) {
      myExternalizer.save(out, result);
    }
  }
  catch (IOException e) {
    LOG.error(e);
  }
}
 
Example #18
Source File: InputMapExternalizer.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
public Map<Key, Value> read(@Nonnull DataInput in) throws IOException {
  int pairs = DataInputOutputUtil.readINT(in);
  if (pairs == 0) return Collections.emptyMap();
  Map<Key, Value> result = new THashMap<>(pairs);
  while (((InputStream)in).available() > 0) {
    Value value = myValueExternalizer.read(in);
    Collection<Key> keys = mySnapshotIndexExternalizer.read(in);
    for (Key k : keys) result.put(k, value);
  }
  return result;
}
 
Example #19
Source File: PersistentIndicesConfiguration.java    From consulo with Apache License 2.0 5 votes vote down vote up
static void loadConfiguration() {
  try (DataInputStream in = new DataInputStream(new BufferedInputStream(new FileInputStream(indicesConfigurationFile())))) {
    if (DataInputOutputUtil.readINT(in) == INDICES_CONFIGURATION_VERSION) {
      IndexingStamp.initPersistentIndexStamp(in);
    }
  }
  catch (IOException ignored) {
  }
}
 
Example #20
Source File: PersistentIndicesConfiguration.java    From consulo with Apache License 2.0 5 votes vote down vote up
static void saveConfiguration() {
  try (DataOutputStream out = new DataOutputStream(new BufferedOutputStream(new FileOutputStream(indicesConfigurationFile())))) {
    DataInputOutputUtil.writeINT(out, INDICES_CONFIGURATION_VERSION);
    IndexingStamp.savePersistentIndexStamp(out);
  }
  catch (IOException ignored) {
  }
}
 
Example #21
Source File: IndexingStamp.java    From consulo with Apache License 2.0 5 votes vote down vote up
IndexVersion(DataInput in) throws IOException {
  myIndexVersion = DataInputOutputUtil.readINT(in);
  myCommonIndicesVersion = DataInputOutputUtil.readINT(in);
  myVfsCreationStamp = DataInputOutputUtil.readTIME(in);
  myModificationCount = DataInputOutputUtil.readTIME(in);
  advanceIndexStamp(myModificationCount);
}
 
Example #22
Source File: StubVersionMap.java    From consulo with Apache License 2.0 5 votes vote down vote up
public boolean isIndexed(int fileId, @Nonnull VirtualFile file) throws IOException {
  DataInputStream stream = FSRecords.readAttributeWithLock(fileId, VERSION_STAMP);
  int diff = stream != null ? DataInputOutputUtil.readINT(stream) : 0;
  if (diff == 0) return false;
  FileType fileType = getFileTypeByIndexingTimestampDiff(diff);
  return fileType != null && getStamp(file.getFileType()) == getStamp(fileType);
}
 
Example #23
Source File: StubVersionMap.java    From consulo with Apache License 2.0 5 votes vote down vote up
public void persistIndexedState(int fileId, @Nonnull VirtualFile file) throws IOException {
  try (DataOutputStream stream = FSRecords.writeAttribute(fileId, VERSION_STAMP)) {
    FileType[] type = {null};
    ProgressManager.getInstance().executeNonCancelableSection(() -> {
      type[0] = file.getFileType();
    });
    DataInputOutputUtil.writeINT(stream, getIndexingTimestampDiffForFileType(type[0]));
  }
}
 
Example #24
Source File: StubForwardIndexExternalizer.java    From consulo with Apache License 2.0 5 votes vote down vote up
<K> Map<StubIndexKey, Map<Object, StubIdList>> doRead(@Nonnull DataInput in, @Nullable StubIndexKey<K, ?> requestedIndex, @Nullable K requestedKey) throws IOException {
  if (!myEnsuredStubElementTypesLoaded) {
    ProgressManager.getInstance().executeNonCancelableSection(() -> {
      SerializationManager.getInstance().initSerializers();
      StubIndexImpl.initExtensions();
    });
    myEnsuredStubElementTypesLoaded = true;
  }
  int stubIndicesValueMapSize = DataInputOutputUtil.readINT(in);
  if (stubIndicesValueMapSize > 0) {
    THashMap<StubIndexKey, Map<Object, StubIdList>> stubIndicesValueMap = requestedIndex != null ? null : new THashMap<>(stubIndicesValueMapSize);
    StubIndexImpl stubIndex = (StubIndexImpl)StubIndex.getInstance();
    StubKeySerializationState stubKeySerializationState = createStubIndexKeySerializationState(in, stubIndicesValueMapSize);
    for (int i = 0; i < stubIndicesValueMapSize; ++i) {
      ID<Object, ?> indexKey = (ID<Object, ?>)readStubIndexKey(in, stubKeySerializationState);
      if (indexKey instanceof StubIndexKey) { // indexKey can be ID in case of removed index
        StubIndexKey<Object, ?> stubIndexKey = (StubIndexKey<Object, ?>)indexKey;
        boolean deserialize = requestedIndex == null || requestedIndex.equals(stubIndexKey);
        if (deserialize) {
          Map<Object, StubIdList> value = stubIndex.deserializeIndexValue(in, stubIndexKey, requestedKey);
          if (requestedIndex != null) {
            return Collections.singletonMap(requestedIndex, value);
          }
          stubIndicesValueMap.put(stubIndexKey, value);
        }
        else {
          stubIndex.skipIndexValue(in);
        }
      }
    }
    return stubIndicesValueMap;
  }
  return Collections.emptyMap();
}
 
Example #25
Source File: StubForwardIndexExternalizer.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
public void save(@Nonnull DataOutput out, Map<StubIndexKey, Map<Object, StubIdList>> indexedStubs) throws IOException {

  DataInputOutputUtil.writeINT(out, indexedStubs.size());
  if (!indexedStubs.isEmpty()) {
    StubKeySerializationState stubKeySerializationState = createStubIndexKeySerializationState(out, indexedStubs.keySet());

    StubIndexImpl stubIndex = (StubIndexImpl)StubIndex.getInstance();
    for (StubIndexKey stubIndexKey : indexedStubs.keySet()) {
      writeStubIndexKey(out, stubIndexKey, stubKeySerializationState);
      Map<Object, StubIdList> map = indexedStubs.get(stubIndexKey);
      stubIndex.serializeIndexValue(out, stubIndexKey, map);
    }
  }
}
 
Example #26
Source File: IntEnumerator.java    From consulo with Apache License 2.0 5 votes vote down vote up
static IntEnumerator read(DataInputStream stream) throws IOException {
  int size = DataInputOutputUtil.readINT(stream);
  IntEnumerator enumerator = new IntEnumerator(false);
  for (int i = 1; i < size + 1; i++) {
    enumerator.myIds.add(DataInputOutputUtil.readINT(stream));
  }
  return enumerator;
}
 
Example #27
Source File: DirectoryEntry.java    From consulo with Apache License 2.0 5 votes vote down vote up
public DirectoryEntry(DataInput in, @SuppressWarnings("unused") boolean dummy /* to distinguish from general constructor*/) throws IOException {
  super(in);
  int count = DataInputOutputUtil.readINT(in);
  myChildren = new ArrayList<>(count);
  while (count-- > 0) {
    unsafeAddChild(StreamUtil.readEntry(in));
  }
}
 
Example #28
Source File: StubSerializationHelper.java    From consulo with Apache License 2.0 5 votes vote down vote up
private byte[] readByteArray(StubInputStream inputStream) throws IOException {
  int length = DataInputOutputUtil.readINT(inputStream);
  if (length == 0) return ArrayUtilRt.EMPTY_BYTE_ARRAY;

  byte[] array = new byte[length];
  int read = inputStream.read(array);
  if (read != array.length) {
    Logger.getInstance(getClass()).error("Serialized array length mismatch");
  }
  return array;
}
 
Example #29
Source File: DirectoryEntry.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
public void write(DataOutput out) throws IOException {
  super.write(out);
  DataInputOutputUtil.writeINT(out, myChildren.size());
  for (Entry child : myChildren) {
    StreamUtil.writeEntry(out, child);
  }
}
 
Example #30
Source File: StubSerializationHelper.java    From consulo with Apache License 2.0 5 votes vote down vote up
void serialize(@Nonnull Stub rootStub, @Nonnull OutputStream stream) throws IOException {
  BufferExposingByteArrayOutputStream out = new BufferExposingByteArrayOutputStream();
  FileLocalStringEnumerator storage = new FileLocalStringEnumerator(true);
  IntEnumerator selializerIdLocalEnumerator = new IntEnumerator();
  StubOutputStream stubOutputStream = new StubOutputStream(out, storage);
  boolean doDefaultSerialization = true;

  if (rootStub instanceof PsiFileStubImpl) {
    final PsiFileStub[] roots = ((PsiFileStubImpl<?>)rootStub).getStubRoots();
    if (roots.length == 0) {
      Logger.getInstance(getClass()).error("Incorrect stub files count during serialization:" + rootStub + "," + rootStub.getStubType());
    }
    else {
      doDefaultSerialization = false;
      DataInputOutputUtil.writeINT(stubOutputStream, roots.length);
      for (PsiFileStub root : roots) {
        serializeRoot(stubOutputStream, root, storage, selializerIdLocalEnumerator);
      }
    }
  }

  if (doDefaultSerialization) {
    DataInputOutputUtil.writeINT(stubOutputStream, 1);
    serializeRoot(stubOutputStream, rootStub, storage, selializerIdLocalEnumerator);
  }
  DataOutputStream resultStream = new DataOutputStream(stream);
  selializerIdLocalEnumerator.dump(resultStream);
  storage.write(resultStream);
  resultStream.write(out.getInternalBuffer(), 0, out.size());
}