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

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

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

ObjectOutputStream.writeLong介绍

[英]Writes a long (64 bit) to the target stream.
[中]向目标流写入长(64位)。

代码示例

代码示例来源:origin: google/guava

private void writeObject(ObjectOutputStream s) throws IOException {
 s.defaultWriteObject();
 s.writeLong(sum());
}

代码示例来源:origin: stackoverflow.com

// never change this
private static final long serialVersionUID = 3375159358757648792L;
// only goes up
private static final int INTERNAL_VERSION_ID = 2;
...
// NOTE: in version #1, this was an int
private long paws;

private void readObject(java.io.ObjectInputStream in) {
  int version = in.readInt();
  switch (version) {
    case 1 :
      paws = in.readInt();
      ...
    case 2 :
      paws = in.readLong();
      ...

private void writeObject(java.io.ObjectOutputStream out) {
  out.writeInt(INTERNAL_VERSION_ID);
  out.writeLong(paws);
  ...

代码示例来源:origin: h2oai/h2o-2

private void writeObject(java.io.ObjectOutputStream s) throws IOException  {
 s.defaultWriteObject();     // Write nothing
 for( long K : keySet() ) {
  final Object V = get(K);  // Do an official 'get'
  s.writeLong  (K);         // Write the <long,TypeV> pair
  s.writeObject(V);
 }
 s.writeLong(NO_KEY);        // Sentinel to indicate end-of-data
 s.writeObject(null);
}

代码示例来源:origin: frohoff/ysoserial

final ObjectOutputStream objOut = new MarshalOutputStream(dos);
objOut.writeLong(2); // DGC
objOut.writeInt(0);
objOut.writeLong(0);
objOut.writeShort(0);
objOut.writeInt(1); // dirty
objOut.writeLong(-669196253586618813L);
objOut.writeObject(payloadObject);

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

private void writeObject(final ObjectOutputStream o)
    throws IOException
{
  o.writeLong(configuredHighestToLowestValueRatio);
  o.writeDouble(currentLowestValueInAutoRange);
  o.writeObject(integerValuesHistogram);
}

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

private void writeObject(final ObjectOutputStream out)
  throws IOException
{
  out.defaultWriteObject();
  out.writeInt(length());
  out.writeObject(lengthRange());
  out.writeLong(_min);
  out.writeLong(_max);
  for (LongGene gene : _genes) {
    out.writeLong(gene.getAllele());
  }
}

代码示例来源:origin: it.unimi.dsi/fastutil

private void writeObject(java.io.ObjectOutputStream s) throws java.io.IOException {
  s.defaultWriteObject();
  for (int i = 0; i < size; i++) {
    s.writeInt(key[i]);
    s.writeLong(value[i]);
  }
}
private void readObject(java.io.ObjectInputStream s) throws java.io.IOException, ClassNotFoundException {

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

private void writeObject(java.io.ObjectOutputStream s) throws IOException  {
 s.defaultWriteObject();     // Write nothing
 for( long K : keySet() ) {
  final Object V = get(K);  // Do an official 'get'
  s.writeLong  (K);         // Write the <long,TypeV> pair
  s.writeObject(V);
 }
 s.writeLong(NO_KEY);        // Sentinel to indicate end-of-data
 s.writeObject(null);
}

代码示例来源:origin: frohoff/ysoserial

final ObjectOutputStream objOut = new JRMPClient.MarshalOutputStream(dos);
objOut.writeLong(obj);
objOut.writeInt(o1);
objOut.writeLong(o2);
objOut.writeShort(o3);
objOut.writeInt(-1);
objOut.writeLong(Util.computeMethodHash(ActivationInstantiator.class.getMethod("newInstance", ActivationID.class, ActivationDesc.class)));
objOut.writeObject(object);
os.flush();
ObjectPayload.Utils.releasePayload(payload, object);

代码示例来源:origin: jenkinsci/jenkins

public long writeHtmlTo(long start, Writer w) throws IOException {
  ConsoleAnnotationOutputStream<T> caw = new ConsoleAnnotationOutputStream<>(
      w, createAnnotator(Stapler.getCurrentRequest()), context, charset);
  long r = super.writeLogTo(start,caw);
  ByteArrayOutputStream baos = new ByteArrayOutputStream();
  Cipher sym = PASSING_ANNOTATOR.encrypt();
  ObjectOutputStream oos = AnonymousClassWarnings.checkingObjectOutputStream(new GZIPOutputStream(new CipherOutputStream(baos,sym)));
  oos.writeLong(System.currentTimeMillis()); // send timestamp to prevent a replay attack
  oos.writeObject(caw.getConsoleAnnotator());
  oos.close();
  StaplerResponse rsp = Stapler.getCurrentResponse();
  if (rsp!=null)
    rsp.setHeader("X-ConsoleAnnotator", new String(Base64.encode(baos.toByteArray())));
  return r;
}

代码示例来源:origin: edu.emory.mathcs.util/emory-util-collections

private void writeObject(ObjectOutputStream out) throws IOException {
  out.defaultWriteObject();
  out.writeInt(keys.length); // the capacity
  out.writeInt(size);        // number of entries
  for (int i=0; i<keys.length; i++) {
    Object val = values[i];
    if (val == null || val == REMOVED) continue;
    out.writeLong(keys[i]);
    out.writeObject(unmaskNull(val));
  }
}

代码示例来源:origin: google/guava

private void writeObject(ObjectOutputStream s) throws IOException {
 s.defaultWriteObject();
 s.writeLong(sum());
}

代码示例来源:origin: it.unimi.dsi/fastutil

private void writeObject(java.io.ObjectOutputStream s) throws java.io.IOException {
  s.defaultWriteObject();
  s.writeInt(heap.length);
  for (int i = 0; i < size; i++)
    s.writeLong(heap[i]);
}

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

private void writeObject(final ObjectOutputStream o)
    throws IOException
{
  o.writeLong(lowestDiscernibleValue);
  o.writeLong(highestTrackableValue);
  o.writeInt(numberOfSignificantValueDigits);
  o.writeInt(getNormalizingIndexOffset());
  o.writeDouble(integerToDoubleValueConversionRatio);
  o.writeLong(getTotalCount());
  // Max Value is added to the serialized form because establishing max via scanning is "harder" during
  // deserialization, as the counts array is not available at the subclass deserializing level, and we don't
  // really want to have each subclass establish max on it's own...
  o.writeLong(maxValue);
  o.writeLong(minNonZeroValue);
  o.writeLong(startTimeStampMsec);
  o.writeLong(endTimeStampMsec);
  o.writeBoolean(autoResize);
  o.writeInt(wordSizeInBytes);
}

代码示例来源:origin: fengjiachun/Jupiter

private void writeObject(java.io.ObjectOutputStream s) throws IOException {
  s.defaultWriteObject();     // Write nothing
  for (long K : keySet()) {
    final Object V = get(K);  // Do an official 'get'
    s.writeLong(K);         // Write the <long,TypeV> pair
    s.writeObject(V);
  }
  s.writeLong(NO_KEY);        // Sentinel to indicate end-of-data
  s.writeObject(null);
}

代码示例来源:origin: aa112901/remusic

private void writeObject(ObjectOutputStream out) throws IOException {
  out.writeObject(cookie.getName());
  out.writeObject(cookie.getValue());
  out.writeObject(cookie.getComment());
  out.writeObject(cookie.getCommentURL());
  out.writeObject(cookie.getDomain());
  out.writeLong(cookie.getMaxAge());
  out.writeObject(cookie.getPath());
  out.writeObject(cookie.getPortlist());
  out.writeInt(cookie.getVersion());
  out.writeBoolean(cookie.getSecure());
  out.writeBoolean(cookie.getDiscard());
}

代码示例来源:origin: GitLqr/LQRWeChat

private void writeObject(ObjectOutputStream out) throws IOException {
  out.writeObject(cookie.name());
  out.writeObject(cookie.value());
  out.writeLong(cookie.persistent() ? cookie.expiresAt() : NON_VALID_EXPIRES_AT);
  out.writeObject(cookie.domain());
  out.writeObject(cookie.path());
  out.writeBoolean(cookie.secure());
  out.writeBoolean(cookie.httpOnly());
  out.writeBoolean(cookie.hostOnly());
}

代码示例来源:origin: prestodb/presto

private void writeObject(ObjectOutputStream s) throws IOException {
 s.defaultWriteObject();
 s.writeLong(sum());
}

代码示例来源:origin: it.unimi.dsi/fastutil

private void writeObject(java.io.ObjectOutputStream s) throws java.io.IOException {
  s.defaultWriteObject();
  for (int i = 0; i < size; i++) {
    s.writeLong(key[i]);
    s.writeInt(value[i]);
  }
}
private void readObject(java.io.ObjectInputStream s) throws java.io.IOException, ClassNotFoundException {

代码示例来源:origin: oracle/opengrok

private void writeObject(ObjectOutputStream out) throws IOException {
    out.writeBoolean(projectName != null); // hasValue
    out.writeUTF(projectName == null ? "" : projectName);

    out.writeBoolean(tabSize != null); // hasValue
    out.writeInt(tabSize == null ? 0 : tabSize);

    out.writeBoolean(analyzerGuruVersion != null); // hasValue
    out.writeLong(analyzerGuruVersion == null ? 0 : analyzerGuruVersion);

    int analyzerCount = analyzersVersions.size();
    out.writeInt(analyzerCount);
    for (Map.Entry<String, Long> entry : analyzersVersions.entrySet()) {
      out.writeUTF(entry.getKey());
      out.writeLong(entry.getValue());
      --analyzerCount;
    }
    if (analyzerCount != 0) {
      throw new IllegalStateException("analyzersVersions were modified");
    }
  }
}

相关文章

ObjectOutputStream类方法