java.io.ObjectOutputStream.writeClassDescriptor()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(7.8k)|赞(0)|评价(0)|浏览(100)

本文整理了Java中java.io.ObjectOutputStream.writeClassDescriptor()方法的一些代码示例,展示了ObjectOutputStream.writeClassDescriptor()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ObjectOutputStream.writeClassDescriptor()方法的具体详情如下:
包路径:java.io.ObjectOutputStream
类名称:ObjectOutputStream
方法名:writeClassDescriptor

ObjectOutputStream.writeClassDescriptor介绍

[英]Writes a class descriptor to the target stream.
[中]将类描述符写入目标流。

代码示例

代码示例来源:origin: apache/incubator-dubbo

@Override
  protected void writeClassDescriptor(ObjectStreamClass desc) throws IOException {
    Class<?> clazz = desc.forClass();
    if (clazz.isPrimitive() || clazz.isArray()) {
      write(0);
      super.writeClassDescriptor(desc);
    } else {
      write(1);
      writeUTF(desc.getName());
    }
  }
}

代码示例来源:origin: apache/incubator-dubbo

@Override
  protected void writeClassDescriptor(ObjectStreamClass desc) throws IOException {
    Class<?> clazz = desc.forClass();
    if (clazz.isPrimitive() || clazz.isArray()) {
      write(0);
      super.writeClassDescriptor(desc);
    } else {
      write(1);
      writeUTF(desc.getName());
    }
  }
}

代码示例来源:origin: netty/netty

@Override
  protected void writeClassDescriptor(ObjectStreamClass desc) throws IOException {
    Class<?> clazz = desc.forClass();
    if (clazz.isPrimitive() || clazz.isArray() || clazz.isInterface() ||
      desc.getSerialVersionUID() == 0) {
      write(TYPE_FAT_DESCRIPTOR);
      super.writeClassDescriptor(desc);
    } else {
      write(TYPE_THIN_DESCRIPTOR);
      writeUTF(desc.getName());
    }
  }
}

代码示例来源:origin: redisson/redisson

@Override
  protected void writeClassDescriptor(ObjectStreamClass desc) throws IOException {
    Class<?> clazz = desc.forClass();
    if (clazz.isPrimitive() || clazz.isArray() || clazz.isInterface() ||
      desc.getSerialVersionUID() == 0) {
      write(TYPE_FAT_DESCRIPTOR);
      super.writeClassDescriptor(desc);
    } else {
      write(TYPE_THIN_DESCRIPTOR);
      writeUTF(desc.getName());
    }
  }
}

代码示例来源:origin: wildfly/wildfly

@Override
  protected void writeClassDescriptor(ObjectStreamClass desc) throws IOException {
    Class<?> clazz = desc.forClass();
    if (clazz.isPrimitive() || clazz.isArray() || clazz.isInterface() ||
      desc.getSerialVersionUID() == 0) {
      write(TYPE_FAT_DESCRIPTOR);
      super.writeClassDescriptor(desc);
    } else {
      write(TYPE_THIN_DESCRIPTOR);
      writeUTF(desc.getName());
    }
  }
}

代码示例来源:origin: io.netty/netty

@Override
  protected void writeClassDescriptor(ObjectStreamClass desc) throws IOException {
    Class<?> clazz = desc.forClass();
    if (clazz.isPrimitive() || clazz.isArray() || clazz.isInterface() ||
      desc.getSerialVersionUID() == 0) {
      write(TYPE_FAT_DESCRIPTOR);
      super.writeClassDescriptor(desc);
    } else {
      write(TYPE_THIN_DESCRIPTOR);
      writeUTF(desc.getName());
    }
  }
}

代码示例来源:origin: redisson/redisson

protected void writeClassDescriptor(ObjectStreamClass desc) throws IOException {
    Class cl = desc.forClass();
    if (ProxyFactory.isProxyClass(cl)) {
      writeBoolean(true);
      Class superClass = cl.getSuperclass();
      Class[] interfaces = cl.getInterfaces();
      byte[] signature = ProxyFactory.getFilterSignature(cl);
      String name = superClass.getName();
      writeObject(name);
      // we don't write the marker interface ProxyObject
      writeInt(interfaces.length - 1);
      for (int i = 0; i < interfaces.length; i++) {
        Class interfaze = interfaces[i];
        if (interfaze != ProxyObject.class && interfaze != Proxy.class) {
          name = interfaces[i].getName();
          writeObject(name);
        }
      }
      writeInt(signature.length);
      write(signature);
    } else {
      writeBoolean(false);
      super.writeClassDescriptor(desc);
    }
  }
}

代码示例来源:origin: wildfly/wildfly

protected void writeClassDescriptor(final ObjectStreamClass desc) throws IOException {
    if (desc.forClass() == SecurityVaultData.class) {
      writeUTF(SecurityVaultData.PICKETBOX_CLASS_NAME);
      writeLong(-1L);
      writeByte(ObjectStreamConstants.SC_SERIALIZABLE | ObjectStreamConstants.SC_WRITE_METHOD);
      writeShort(0); // no fields
    } else {
      super.writeClassDescriptor(desc);
    }
  }
}

代码示例来源:origin: org.javassist/javassist

@Override
  protected void writeClassDescriptor(ObjectStreamClass desc) throws IOException {
    Class<?> cl = desc.forClass();
    if (ProxyFactory.isProxyClass(cl)) {
      writeBoolean(true);
      Class<?> superClass = cl.getSuperclass();
      Class<?>[] interfaces = cl.getInterfaces();
      byte[] signature = ProxyFactory.getFilterSignature(cl);
      String name = superClass.getName();
      writeObject(name);
      // we don't write the marker interface ProxyObject
      writeInt(interfaces.length - 1);
      for (int i = 0; i < interfaces.length; i++) {
        Class<?> interfaze = interfaces[i];
        if (interfaze != ProxyObject.class && interfaze != Proxy.class) {
          name = interfaces[i].getName();
          writeObject(name);
        }
      }
      writeInt(signature.length);
      write(signature);
    } else {
      writeBoolean(false);
      super.writeClassDescriptor(desc);
    }
  }
}

代码示例来源:origin: scouter-project/scouter

protected void writeClassDescriptor(ObjectStreamClass desc) throws IOException {
    Class cl = desc.forClass();
    if (ProxyFactory.isProxyClass(cl)) {
      writeBoolean(true);
      Class superClass = cl.getSuperclass();
      Class[] interfaces = cl.getInterfaces();
      byte[] signature = ProxyFactory.getFilterSignature(cl);
      String name = superClass.getName();
      writeObject(name);
      // we don't write the marker interface ProxyObject
      writeInt(interfaces.length - 1);
      for (int i = 0; i < interfaces.length; i++) {
        Class interfaze = interfaces[i];
        if (interfaze != ProxyObject.class && interfaze != Proxy.class) {
          name = interfaces[i].getName();
          writeObject(name);
        }
      }
      writeInt(signature.length);
      write(signature);
    } else {
      writeBoolean(false);
      super.writeClassDescriptor(desc);
    }
  }
}

代码示例来源:origin: scouter-project/scouter

@Override
  protected void writeClassDescriptor(ObjectStreamClass desc) throws IOException {
    Class<?> cl = desc.forClass();
    if (ProxyFactory.isProxyClass(cl)) {
      writeBoolean(true);
      Class<?> superClass = cl.getSuperclass();
      Class<?>[] interfaces = cl.getInterfaces();
      byte[] signature = ProxyFactory.getFilterSignature(cl);
      String name = superClass.getName();
      writeObject(name);
      // we don't write the marker interface ProxyObject
      writeInt(interfaces.length - 1);
      for (int i = 0; i < interfaces.length; i++) {
        Class<?> interfaze = interfaces[i];
        if (interfaze != ProxyObject.class && interfaze != Proxy.class) {
          name = interfaces[i].getName();
          writeObject(name);
        }
      }
      writeInt(signature.length);
      write(signature);
    } else {
      writeBoolean(false);
      super.writeClassDescriptor(desc);
    }
  }
}

代码示例来源:origin: robovm/robovm

writeClassDescriptor(classDesc);
primitiveTypes = null;

代码示例来源:origin: robovm/robovm

writeClassDescriptor(classDesc);
primitiveTypes = null;

代码示例来源:origin: killme2008/xmemcached

@Override
 protected void writeClassDescriptor(ObjectStreamClass desc) throws IOException {
  if (desc.forClass().isPrimitive()) {
   write(0);
   super.writeClassDescriptor(desc);
  } else {
   write(1);
   writeUTF(desc.getName());
  }
 }
};

代码示例来源:origin: au.net.zeus.jgdms/jgdms-platform

@Override
public void writeClassDescriptor(ObjectStreamClass o) throws IOException {
  super.writeClassDescriptor(o);
}
}

代码示例来源:origin: jobxhub/JobX

@Override
  protected void writeClassDescriptor(ObjectStreamClass desc) throws IOException {
    Class<?> clazz = desc.forClass();
    if (clazz.isPrimitive() || clazz.isArray()) {
      write(0);
      super.writeClassDescriptor(desc);
    } else {
      write(1);
      writeUTF(desc.getName());
    }
  }
}

代码示例来源:origin: com.alibaba/dubbo

@Override
  protected void writeClassDescriptor(ObjectStreamClass desc) throws IOException {
    Class<?> clazz = desc.forClass();
    if (clazz.isPrimitive() || clazz.isArray()) {
      write(0);
      super.writeClassDescriptor(desc);
    } else {
      write(1);
      writeUTF(desc.getName());
    }
  }
}

代码示例来源:origin: com.alibaba/dubbo-serialization-jdk

@Override
  protected void writeClassDescriptor(ObjectStreamClass desc) throws IOException {
    Class<?> clazz = desc.forClass();
    if (clazz.isPrimitive() || clazz.isArray()) {
      write(0);
      super.writeClassDescriptor(desc);
    } else {
      write(1);
      writeUTF(desc.getName());
    }
  }
}

代码示例来源:origin: com.taobao.gecko/gecko

@Override
  protected void writeClassDescriptor(ObjectStreamClass desc) throws IOException {
    if (desc.forClass().isPrimitive()) {
      write(0);
      super.writeClassDescriptor(desc);
    }
    else {
      write(1);
      writeUTF(desc.getName());
    }
  }
};

代码示例来源:origin: org.wildfly.security/wildfly-elytron

protected void writeClassDescriptor(final ObjectStreamClass desc) throws IOException {
    if (desc.forClass() == SecurityVaultData.class) {
      writeUTF(SecurityVaultData.PICKETBOX_CLASS_NAME);
      writeLong(-1L);
      writeByte(ObjectStreamConstants.SC_SERIALIZABLE | ObjectStreamConstants.SC_WRITE_METHOD);
      writeShort(0); // no fields
    } else {
      super.writeClassDescriptor(desc);
    }
  }
}

相关文章

ObjectOutputStream类方法