Tabnine Logo
ByteChunk.getEnd
Code IndexAdd Tabnine to your IDE (free)

How to use
getEnd
method
in
org.apache.tomcat.util.buf.ByteChunk

Best Java code snippets using org.apache.tomcat.util.buf.ByteChunk.getEnd (Showing top 20 results out of 315)

origin: line/armeria

public int doWrite(ByteChunk chunk) {
  final int start = chunk.getStart();
  final int end = chunk.getEnd();
  final int length = end - start;
  if (length == 0) {
    return 0;
  }
  // NB: We make a copy because Tomcat reuses the underlying byte array of 'chunk'.
  final byte[] content = Arrays.copyOfRange(chunk.getBuffer(), start, end);
  data.add(HttpData.of(content));
  bytesWritten += length;
  return length;
}
origin: line/armeria

@Override
public int doWrite(ByteChunk chunk, Response response) throws IOException {
  final int start = chunk.getStart();
  final int end = chunk.getEnd();
  final int length = end - start;
  if (length == 0) {
    return 0;
  }
  // NB: We make a copy because Tomcat reuses the underlying byte array of 'chunk'.
  final byte[] content = Arrays.copyOfRange(chunk.getBuffer(), start, end);
  data.add(HttpData.of(content));
  bytesWritten += length;
  return length;
}
origin: org.ops4j.pax.tipi/org.ops4j.pax.tipi.tomcat-embed-core

  @Override
  public boolean isFinished() {
    return input.getOffset() >= input.getEnd();
  }
}
origin: codefollower/Tomcat-Research

  @Override
  public boolean isFinished() {
    return input.getOffset() >= input.getEnd();
  }
}
origin: org.ops4j.pax.tipi/org.ops4j.pax.tipi.tomcat-embed-core

@Override
public int doRead(ApplicationBufferHandler handler) throws IOException {
  if(input.getOffset()>= input.getEnd())
    return -1;
  ByteBuffer byteBuffer = handler.getByteBuffer();
  byteBuffer.position(byteBuffer.limit()).limit(byteBuffer.capacity());
  input.subtract(byteBuffer);
  return byteBuffer.remaining();
}
origin: codefollower/Tomcat-Research

protected void urlEncode(CharChunk out, ByteChunk bb)
  throws IOException {
  byte[] bytes = bb.getBuffer();
  for (int j = bb.getStart(); j < bb.getEnd(); j++) {
    out.append('%');
    char ch = Character.forDigit((bytes[j] >> 4) & 0xF, 16);
    out.append(ch);
    ch = Character.forDigit(bytes[j] & 0xF, 16);
    out.append(ch);
  }
}
origin: org.ops4j.pax.tipi/org.ops4j.pax.tipi.tomcat-embed-core

public MessageBytesReader(MessageBytes mb) {
  ByteChunk bc = mb.getByteChunk();
  bytes = bc.getBytes();
  pos = bc.getOffset();
  end = bc.getEnd();
}
origin: org.apache.geronimo.ext.tomcat/util

protected void urlEncode(CharChunk out, ByteChunk bb)
  throws IOException {
  byte[] bytes = bb.getBuffer();
  for (int j = bb.getStart(); j < bb.getEnd(); j++) {
    out.append('%');
    char ch = Character.forDigit((bytes[j] >> 4) & 0xF, 16);
    out.append(ch);
    ch = Character.forDigit(bytes[j] & 0xF, 16);
    out.append(ch);
  }
}
origin: org.jboss.web/jbossweb

protected void urlEncode(CharChunk out, ByteChunk bb)
  throws IOException {
  byte[] bytes = bb.getBuffer();
  for (int j = bb.getStart(); j < bb.getEnd(); j++) {
    out.append('%');
    char ch = Character.forDigit((bytes[j] >> 4) & 0xF, 16);
    out.append(ch);
    ch = Character.forDigit(bytes[j] & 0xF, 16);
    out.append(ch);
  }
}

origin: jboss.web/jbossweb

protected void urlEncode(CharChunk out, ByteChunk bb)
  throws IOException {
  byte[] bytes = bb.getBuffer();
  for (int j = bb.getStart(); j < bb.getEnd(); j++) {
    out.append('%');
    char ch = Character.forDigit((bytes[j] >> 4) & 0xF, 16);
    out.append(ch);
    ch = Character.forDigit(bytes[j] & 0xF, 16);
    out.append(ch);
  }
}

origin: org.ops4j.pax.tipi/org.ops4j.pax.tipi.tomcat-embed-core

protected void urlEncode(CharChunk out, ByteChunk bb)
  throws IOException {
  byte[] bytes = bb.getBuffer();
  for (int j = bb.getStart(); j < bb.getEnd(); j++) {
    out.append('%');
    char ch = Character.forDigit((bytes[j] >> 4) & 0xF, 16);
    out.append(ch);
    ch = Character.forDigit(bytes[j] & 0xF, 16);
    out.append(ch);
  }
}
origin: org.apache.coyote.springsource/com.springsource.org.apache.coyote.springsource

/**
 * Read bytes.
 */
public int doRead(ByteChunk chunk, org.apache.coyote.Request request)
    throws IOException {
  int writeLength = 0;
  
  if (chunk.getLimit() > 0 && chunk.getLimit() < input.getLength()) {
    writeLength = chunk.getLimit();
  } else {
    writeLength = input.getLength();
  }
  
  if(input.getOffset()>= input.getEnd())
    return -1;
  
  input.substract(chunk.getBuffer(), 0, writeLength);
  chunk.setOffset(0);
  chunk.setEnd(writeLength);
  
  return writeLength;
}
origin: org.jboss.web/jbossweb

/**
 * Read bytes.
 */
public int doRead(ByteChunk chunk, org.apache.coyote.Request request)
    throws IOException {
  int writeLength = 0;
  
  if (chunk.getLimit() > 0 && chunk.getLimit() < input.getLength()) {
    writeLength = chunk.getLimit();
  } else {
    writeLength = input.getLength();
  }
  
  if(input.getOffset()>= input.getEnd())
    return -1;
  
  input.substract(chunk.getBuffer(), 0, writeLength);
  chunk.setOffset(0);
  chunk.setEnd(writeLength);
  
  return writeLength;
}
origin: codefollower/Tomcat-Research

/**
 * Read bytes.
 */
@Override
public int doRead(ByteChunk chunk, org.apache.coyote.Request request)
    throws IOException {
  if(input.getOffset()>= input.getEnd())
    return -1;
  int writeLength = 0;
  if (chunk.getLimit() > 0 && chunk.getLimit() < input.getLength()) {
    writeLength = chunk.getLimit();
  } else {
    writeLength = input.getLength();
  }
  input.substract(chunk.getBuffer(), 0, writeLength);
  chunk.setOffset(0);
  chunk.setEnd(writeLength);
  return writeLength;
}
origin: jboss.web/jbossweb

/**
 * Read bytes.
 */
public int doRead(ByteChunk chunk, org.apache.coyote.Request request)
    throws IOException {
  int writeLength = 0;
  
  if (chunk.getLimit() > 0 && chunk.getLimit() < input.getLength()) {
    writeLength = chunk.getLimit();
  } else {
    writeLength = input.getLength();
  }
  
  if(input.getOffset()>= input.getEnd())
    return -1;
  
  input.substract(chunk.getBuffer(), 0, writeLength);
  chunk.setOffset(0);
  chunk.setEnd(writeLength);
  
  return writeLength;
}
origin: org.apache.coyote/com.springsource.org.apache.coyote

/**
 * Read bytes.
 */
@Override
public int doRead(ByteChunk chunk, org.apache.coyote.Request request)
    throws IOException {
  int writeLength = 0;
  
  if (chunk.getLimit() > 0 && chunk.getLimit() < input.getLength()) {
    writeLength = chunk.getLimit();
  } else {
    writeLength = input.getLength();
  }
  
  if(input.getOffset()>= input.getEnd())
    return -1;
  
  input.substract(chunk.getBuffer(), 0, writeLength);
  chunk.setOffset(0);
  chunk.setEnd(writeLength);
  
  return writeLength;
}
origin: org.apache.geronimo.ext.tomcat/catalina

/**
 * Read bytes.
 */
@Override
public int doRead(ByteChunk chunk, org.apache.coyote.Request request)
    throws IOException {
  int writeLength = 0;
  
  if (chunk.getLimit() > 0 && chunk.getLimit() < input.getLength()) {
    writeLength = chunk.getLimit();
  } else {
    writeLength = input.getLength();
  }
  
  if(input.getOffset()>= input.getEnd())
    return -1;
  
  input.substract(chunk.getBuffer(), 0, writeLength);
  chunk.setOffset(0);
  chunk.setEnd(writeLength);
  
  return writeLength;
}
origin: com.ovea.tajin.server/tajin-server-tomcat7

/**
 * Read bytes.
 */
@Override
public int doRead(ByteChunk chunk, org.apache.coyote.Request request)
    throws IOException {
  int writeLength = 0;
  
  if (chunk.getLimit() > 0 && chunk.getLimit() < input.getLength()) {
    writeLength = chunk.getLimit();
  } else {
    writeLength = input.getLength();
  }
  
  if(input.getOffset()>= input.getEnd())
    return -1;
  
  input.substract(chunk.getBuffer(), 0, writeLength);
  chunk.setOffset(0);
  chunk.setEnd(writeLength);
  
  return writeLength;
}
origin: com.ovea.tajin.servers/tajin-server-jetty9

public int realReadChars(char cbuf[], int off, int len)
  throws IOException {
  if (!gotEnc)
    setConverter();
  if (bb.getLength() <= 0) {
    int nRead = realReadBytes(bb.getBytes(), 0, bb.getBytes().length);
    if (nRead < 0) {
      return -1;
    }
  }
  if (markPos == -1) {
    cb.setOffset(0);
    cb.setEnd(0);
  }
  int limit = bb.getLength()+cb.getStart();
  if ( cb.getLimit() < limit )
    cb.setLimit(limit);
  state = CHAR_STATE;
  conv.convert(bb, cb, bb.getLength());
  bb.setOffset(bb.getEnd());
  return cb.getLength();
}
origin: com.ovea.tajin.server/tajin-server-tomcat7

public int realReadChars(char cbuf[], int off, int len)
  throws IOException {
  if (!gotEnc)
    setConverter();
  if (bb.getLength() <= 0) {
    int nRead = realReadBytes(bb.getBytes(), 0, bb.getBytes().length);
    if (nRead < 0) {
      return -1;
    }
  }
  if (markPos == -1) {
    cb.setOffset(0);
    cb.setEnd(0);
  }
  int limit = bb.getLength()+cb.getStart();
  if ( cb.getLimit() < limit )
    cb.setLimit(limit);
  state = CHAR_STATE;
  conv.convert(bb, cb, bb.getLength());
  bb.setOffset(bb.getEnd());
  return cb.getLength();
}
org.apache.tomcat.util.bufByteChunkgetEnd

Popular methods of ByteChunk

  • getBuffer
    Returns the message bytes.
  • getLength
    Returns the length of the bytes. XXX need to clean this up
  • getStart
    Returns the start offset of the bytes. For output this is the end of the buffer.
  • setBytes
    Sets the message bytes to the specified subarray of bytes.
  • <init>
  • getOffset
  • setOffset
  • startsWithIgnoreCase
    Returns true if the message bytes starts with the specified string.
  • append
    Add data to the buffer
  • getBytes
    Returns the message bytes.
  • indexOf
    Returns the first instance of the given character in the given byte array between the specified star
  • setEnd
  • indexOf,
  • setEnd,
  • setLimit,
  • recycle,
  • flushBuffer,
  • toString,
  • getLimit,
  • substract,
  • setByteOutputChannel

Popular in Java

  • Finding current android device location
  • addToBackStack (FragmentTransaction)
  • scheduleAtFixedRate (Timer)
  • getSupportFragmentManager (FragmentActivity)
  • PrintWriter (java.io)
    Wraps either an existing OutputStream or an existing Writerand provides convenience methods for prin
  • RandomAccessFile (java.io)
    Allows reading from and writing to a file in a random-access manner. This is different from the uni-
  • NumberFormat (java.text)
    The abstract base class for all number formats. This class provides the interface for formatting and
  • TreeSet (java.util)
    TreeSet is an implementation of SortedSet. All optional operations (adding and removing) are support
  • Executor (java.util.concurrent)
    An object that executes submitted Runnable tasks. This interface provides a way of decoupling task s
  • ImageIO (javax.imageio)
  • 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