Codota Logo
AnonymousClassWarnings.checkingObjectOutputStream
Code IndexAdd Codota to your IDE (free)

How to use
checkingObjectOutputStream
method
in
org.jenkinsci.remoting.util.AnonymousClassWarnings

Best Java code snippets using org.jenkinsci.remoting.util.AnonymousClassWarnings.checkingObjectOutputStream (Showing top 9 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
OutputStreamWriter o =
  • Codota IconOutputStream out;new OutputStreamWriter(out)
  • Codota IconOutputStream out;String charsetName;new OutputStreamWriter(out, charsetName)
  • Codota IconHttpURLConnection connection;new OutputStreamWriter(connection.getOutputStream())
  • Smart code suggestions by Codota
}
origin: jenkinsci/jenkins

/**
 * Sends a serializable object.
 */
public void writeObject(Object o) throws IOException {
  ObjectOutputStream oos = AnonymousClassWarnings.checkingObjectOutputStream(out);
  oos.writeObject(o);
  // don't close oss, which will close the underlying stream
  // no need to flush either, given the way oos is implemented
}
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: jenkinsci/jenkins

private ByteArrayOutputStream encodeToBytes() throws IOException {
  ByteArrayOutputStream buf = new ByteArrayOutputStream();
  try (OutputStream gzos = new GZIPOutputStream(buf);
     ObjectOutputStream oos = JenkinsJVM.isJenkinsJVM() ? AnonymousClassWarnings.checkingObjectOutputStream(gzos) : new ObjectOutputStream(gzos)) {
    oos.writeObject(this);
  }
  ByteArrayOutputStream buf2 = new ByteArrayOutputStream();
  DataOutputStream dos = new DataOutputStream(new Base64OutputStream(buf2,true,-1,null));
  try {
    buf2.write(PREAMBLE);
    if (JenkinsJVM.isJenkinsJVM()) { // else we are in another JVM and cannot sign; result will be ignored unless INSECURE
      byte[] mac = MAC.mac(buf.toByteArray());
      dos.writeInt(- mac.length); // negative to differentiate from older form
      dos.write(mac);
    }
    dos.writeInt(buf.size());
    buf.writeTo(dos);
  } finally {
    dos.close();
  }
  buf2.write(POSTAMBLE);
  return buf2;
}
origin: jenkinsci/remoting

@Override
public final void write(Command cmd, boolean last) throws IOException {
  ByteArrayOutputStream baos = new ByteArrayOutputStream();
  ObjectOutputStream oos = AnonymousClassWarnings.checkingObjectOutputStream(baos);
  cmd.writeTo(channel,oos);
  oos.close();
  byte[] block = baos.toByteArray();
  channel.notifyWrite(cmd, block.length);
  writeBlock(channel, block);
}
origin: jenkinsci/remoting

  @Override
  public void write(Command cmd, boolean last) throws IOException {
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    ObjectOutputStream oos = AnonymousClassWarnings.checkingObjectOutputStream(baos);
    cmd.writeTo(channel,oos);
    oos.close();
    byte[] block = baos.toByteArray();
    channel.notifyWrite(cmd, block.length);
    writeBlock(channel, block);
  }
}
origin: jenkinsci/remoting

private byte[] _serialize(Object o, final Channel channel) throws IOException {
  Channel old = Channel.setCurrent(channel);
  try {
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    ObjectOutputStream oos;
    if (channel.remoteCapability.supportsMultiClassLoaderRPC())
      oos = new MultiClassLoaderSerializer.Output(channel,baos);
    else
      oos = AnonymousClassWarnings.checkingObjectOutputStream(baos);
    oos.writeObject(o);
    return baos.toByteArray();
  } finally {
    Channel.setCurrent(old);
  }
}
origin: jenkinsci/remoting

/**
 * {@inheritDoc}
 */
@Override
public void start() throws IOException {
  try {
    ByteArrayOutputStream bos = new ByteArrayOutputStream();
    ObjectOutputStream oos = AnonymousClassWarnings.checkingObjectOutputStream(BinarySafeStream.wrap(bos));
    try {
      oos.writeObject(new Capability());
    } finally {
      oos.close();
    }
    ByteBuffer buffer = ByteBufferUtils.wrapUTF8(bos.toString("US-ASCII"));
    write(buffer);
  } catch (IOException e) {
    futureChannel.setException(e);
  }
}
origin: jenkinsci/remoting

/**
 * {@inheritDoc}
 */
@Override
public final void write(Command cmd, boolean last) throws IOException {
  ByteBufferQueueOutputStream bqos = new ByteBufferQueueOutputStream(sendStaging);
  ObjectOutputStream oos = AnonymousClassWarnings.checkingObjectOutputStream(bqos);
  try {
    cmd.writeTo(channel, oos);
  } finally {
    oos.close();
  }
  long remaining = sendStaging.remaining();
  channel.notifyWrite(cmd, remaining);
  while (remaining > 0L) {
    int frame = remaining > transportFrameSize
        ? transportFrameSize
        : (int) remaining; // # of bytes we send in this chunk
    writeChunkHeader.clear();
    ChunkHeader.write(writeChunkHeader, frame, remaining > transportFrameSize);
    writeChunkHeader.flip();
    writeChunkBody.clear();
    writeChunkBody.limit(frame);
    sendStaging.get(writeChunkBody);
    writeChunkBody.flip();
    write(writeChunkHeader, writeChunkBody);
    remaining -= frame;
  }
}
origin: jenkinsci/remoting

  /**
   * Instantiate a transport.
   *
   * @param is
   *      The negotiated input stream that hides
   * @param os
   *      {@linkplain CommandTransport#getUnderlyingStream() the underlying stream}.
   * @param mode
   *      The mode to create the transport in.
   * @param cap
   *      Capabilities of the other side, as determined during the handshaking.
   */
  protected CommandTransport makeTransport(InputStream is, OutputStream os, Mode mode, Capability cap) throws IOException {
    FlightRecorderInputStream fis = new FlightRecorderInputStream(is);

    if (cap.supportsChunking())
      return new ChunkedCommandTransport(cap, mode.wrap(fis), mode.wrap(os), os);
    else {
      ObjectOutputStream oos = AnonymousClassWarnings.checkingObjectOutputStream(mode.wrap(os));
      oos.flush();    // make sure that stream preamble is sent to the other end. avoids dead-lock

      return new ClassicCommandTransport(
          new ObjectInputStreamEx(mode.wrap(fis),getBaseLoader(),getClassFilter()),
          oos,fis,os,cap);
    }
  }
}
org.jenkinsci.remoting.utilAnonymousClassWarningscheckingObjectOutputStream

Javadoc

Like ObjectOutputStream#ObjectOutputStream(OutputStream) but applies #check when writing classes.

Popular methods of AnonymousClassWarnings

  • check
    Checks a class which is being either serialized or deserialized. A warning will only be printed once
  • codeSource
  • doCheck
  • warn

Popular in Java

  • Finding current android device location
  • setRequestProperty (URLConnection)
  • getResourceAsStream (ClassLoader)
    Returns a stream for the resource with the specified name. See #getResource(String) for a descriptio
  • getSupportFragmentManager (FragmentActivity)
    Return the FragmentManager for interacting with fragments associated with this activity.
  • SocketException (java.net)
    This SocketException may be thrown during socket creation or setting options, and is the superclass
  • URI (java.net)
    Represents a Uniform Resource Identifier (URI) reference. Aside from some minor deviations noted bel
  • NumberFormat (java.text)
    The abstract base class for all number formats. This class provides the interface for formatting and
  • Date (java.util)
    A specific moment in time, with millisecond precision. Values typically come from System#currentTime
  • TimeZone (java.util)
    TimeZone represents a time zone offset, and also figures out daylight savings. Typically, you get a
  • Reflections (org.reflections)
    Reflections one-stop-shop objectReflections scans your classpath, indexes the metadata, allows you t
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now