Tabnine Logo
ByteCountOutputStream
Code IndexAdd Tabnine to your IDE (free)

How to use
ByteCountOutputStream
in
ca.nrc.cadc.io

Best Java code snippets using ca.nrc.cadc.io.ByteCountOutputStream (Showing top 8 results out of 315)

origin: org.opencadc/cadc-util

@Override
public void write(int b)
  throws IOException
{
  if (hasReachedLimit())
    throw new ByteLimitExceededException(byteLimit);
  ostream.write(b);
  byteCount++;
}
origin: org.opencadc/cadc-uws-server

  protected void writeJob(Job job) throws IOException {
    // TODO: content negotiation via accept header
    JobWriter w = new JobWriter();
    syncOutput.setHeader("Content-Type", "text/xml");
    OutputStream os = syncOutput.getOutputStream();
    ByteCountOutputStream bc = new ByteCountOutputStream(os);
    w.write(job, bc);
    logInfo.setBytes(bc.getByteCount());
  }
}
origin: org.opencadc/cadc-uws-server

private void writeParameters(List<Parameter> params) throws IOException {
  // TODO: content negotiation via accept header
  JobWriter w = new JobWriter();
  syncOutput.setHeader("Content-Type", "text/xml");
  OutputStream os = syncOutput.getOutputStream();
  ByteCountOutputStream bc = new ByteCountOutputStream(os);
  w.writeParametersDoc(params, bc);
  logInfo.setBytes(bc.getByteCount());
}
origin: org.opencadc/cadc-uws-server

private void writeResults(List<Result> params) throws IOException {
  // TODO: content negotiation via accept header
  JobWriter w = new JobWriter();
  syncOutput.setHeader("Content-Type", "text/xml");
  OutputStream os = syncOutput.getOutputStream();
  ByteCountOutputStream bc = new ByteCountOutputStream(os);
  w.writeResultsDoc(params, bc);
  logInfo.setBytes(bc.getByteCount());
}
origin: org.opencadc/cadc-util

@Override
public void write(byte[] b)
  throws IOException
{
  if (hasReachedLimit())
    throw new ByteLimitExceededException(byteLimit);
  ostream.write(b);
  byteCount += b.length;
}
origin: org.opencadc/cadc-uws-server

ByteCountOutputStream bc = new ByteCountOutputStream(os);
PrintWriter w = new PrintWriter(bc);
w.print(value);
w.flush();
logInfo.setBytes(bc.getByteCount());
origin: org.opencadc/cadc-util

@Override
public void write(byte[] b, int offset, int num)
  throws IOException
{
  if (hasReachedLimit())
    throw new ByteLimitExceededException(byteLimit);
  ostream.write(b, offset, num);
  byteCount += num;
}

origin: org.opencadc/cadc-uws-server

syncOutput.setHeader("Content-Type", "text/xml");
OutputStream os = syncOutput.getOutputStream();
ByteCountOutputStream bc = new ByteCountOutputStream(os);
w.write(jobs, os);
logInfo.setBytes(bc.getByteCount());
ca.nrc.cadc.ioByteCountOutputStream

Javadoc

Simple OutputStream wrapper that keeps track of bytes written. Alternate constructors allow for byte limits to be set and for the lazy retrieval of the output stream from an HttpServletResponse object.

Most used methods

  • <init>
    Constructor that takes the target output stream and a byte limit.
  • getByteCount
    Get the number of bytes written to the underlying output stream to far. This value is up to date rig
  • hasReachedLimit
    Obtain whether the byte limit has been reached.

Popular in Java

  • Start an intent from android
  • scheduleAtFixedRate (Timer)
  • startActivity (Activity)
  • setScale (BigDecimal)
  • Component (java.awt)
    A component is an object having a graphical representation that can be displayed on the screen and t
  • BufferedInputStream (java.io)
    A BufferedInputStream adds functionality to another input stream-namely, the ability to buffer the i
  • SocketTimeoutException (java.net)
    This exception is thrown when a timeout expired on a socket read or accept operation.
  • Calendar (java.util)
    Calendar is an abstract base class for converting between a Date object and a set of integer fields
  • TimeZone (java.util)
    TimeZone represents a time zone offset, and also figures out daylight savings. Typically, you get a
  • JCheckBox (javax.swing)
  • Github Copilot alternatives
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now