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

How to use
setEnd
method
in
org.glassfish.grizzly.http.util.ByteChunk

Best Java code snippets using org.glassfish.grizzly.http.util.ByteChunk.setEnd (Showing top 20 results out of 315)

origin: org.glassfish.grizzly/grizzly-websockets-server

/** Generate the bytes using the specified encoding
 */
public void convert(char c[], int off, int len) throws IOException {
  CharBuffer cb = CharBuffer.wrap(c, off, len);
  byte[] barr = bb.getBuffer();
  int boff = bb.getEnd();
  ByteBuffer tmp = ByteBuffer.wrap(barr, boff, barr.length - boff);
  CoderResult cr = encoder.encode(cb, tmp, true);
  bb.setEnd(tmp.position());
  while (cr == CoderResult.OVERFLOW) {
  if (!bb.canGrow())
      bb.flushBuffer();
  boff = bb.getEnd();
  barr = bb.getBuffer();
    tmp = ByteBuffer.wrap(barr, boff, barr.length - boff);
    cr = encoder.encode(cb, tmp, true);
    bb.setEnd(tmp.position());
  }
  if (cr != CoderResult.UNDERFLOW) {
    throw new IOException("Encoding error");
}
}
origin: javaee/grizzly

/** Generate the bytes using the specified encoding
 */
public void convert(char c[], int off, int len) throws IOException {
  CharBuffer cb = CharBuffer.wrap(c, off, len);
  byte[] barr = bb.getBuffer();
  int boff = bb.getEnd();
  ByteBuffer tmp = ByteBuffer.wrap(barr, boff, barr.length - boff);
  CoderResult cr = encoder.encode(cb, tmp, true);
  bb.setEnd(tmp.position());
  while (cr == CoderResult.OVERFLOW) {
  if (!bb.canGrow())
      bb.flushBuffer();
  boff = bb.getEnd();
  barr = bb.getBuffer();
    tmp = ByteBuffer.wrap(barr, boff, barr.length - boff);
    cr = encoder.encode(cb, tmp, true);
    bb.setEnd(tmp.position());
  }
  if (cr != CoderResult.UNDERFLOW) {
    throw new IOException("Encoding error");
}
}
origin: javaee/grizzly

/** Generate the bytes using the specified encoding
 */
public void convert(char c[], int off, int len) throws IOException {
  CharBuffer cb = CharBuffer.wrap(c, off, len);
  byte[] barr = bb.getBuffer();
  int boff = bb.getEnd();
  ByteBuffer tmp = ByteBuffer.wrap(barr, boff, barr.length - boff);
  CoderResult cr = encoder.encode(cb, tmp, true);
  bb.setEnd(tmp.position());
  while (cr == CoderResult.OVERFLOW) {
  if (!bb.canGrow())
      bb.flushBuffer();
  boff = bb.getEnd();
  barr = bb.getBuffer();
    tmp = ByteBuffer.wrap(barr, boff, barr.length - boff);
    cr = encoder.encode(cb, tmp, true);
    bb.setEnd(tmp.position());
  }
  if (cr != CoderResult.UNDERFLOW) {
    throw new IOException("Encoding error");
}
}
origin: org.glassfish.grizzly/grizzly-http-server-core

/** Generate the bytes using the specified encoding
 */
public void convert(char c[], int off, int len) throws IOException {
  CharBuffer cb = CharBuffer.wrap(c, off, len);
  byte[] barr = bb.getBuffer();
  int boff = bb.getEnd();
  ByteBuffer tmp = ByteBuffer.wrap(barr, boff, barr.length - boff);
  CoderResult cr = encoder.encode(cb, tmp, true);
  bb.setEnd(tmp.position());
  while (cr == CoderResult.OVERFLOW) {
  if (!bb.canGrow())
      bb.flushBuffer();
  boff = bb.getEnd();
  barr = bb.getBuffer();
    tmp = ByteBuffer.wrap(barr, boff, barr.length - boff);
    cr = encoder.encode(cb, tmp, true);
    bb.setEnd(tmp.position());
  }
  if (cr != CoderResult.UNDERFLOW) {
    throw new IOException("Encoding error");
}
}
origin: javaee/grizzly

/** Generate the bytes using the specified encoding
 */
public void convert(char c[], int off, int len) throws IOException {
  CharBuffer cb = CharBuffer.wrap(c, off, len);
  byte[] barr = bb.getBuffer();
  int boff = bb.getEnd();
  ByteBuffer tmp = ByteBuffer.wrap(barr, boff, barr.length - boff);
  CoderResult cr = encoder.encode(cb, tmp, true);
  bb.setEnd(tmp.position());
  while (cr == CoderResult.OVERFLOW) {
  if (!bb.canGrow())
      bb.flushBuffer();
  boff = bb.getEnd();
  barr = bb.getBuffer();
    tmp = ByteBuffer.wrap(barr, boff, barr.length - boff);
    cr = encoder.encode(cb, tmp, true);
    bb.setEnd(tmp.position());
  }
  if (cr != CoderResult.UNDERFLOW) {
    throw new IOException("Encoding error");
}
}
origin: javaee/grizzly

/** Generate the bytes using the specified encoding
 */
public void convert(char c[], int off, int len) throws IOException {
  CharBuffer cb = CharBuffer.wrap(c, off, len);
  byte[] barr = bb.getBuffer();
  int boff = bb.getEnd();
  ByteBuffer tmp = ByteBuffer.wrap(barr, boff, barr.length - boff);
  CoderResult cr = encoder.encode(cb, tmp, true);
  bb.setEnd(tmp.position());
  while (cr == CoderResult.OVERFLOW) {
  if (!bb.canGrow())
      bb.flushBuffer();
  boff = bb.getEnd();
  barr = bb.getBuffer();
    tmp = ByteBuffer.wrap(barr, boff, barr.length - boff);
    cr = encoder.encode(cb, tmp, true);
    bb.setEnd(tmp.position());
  }
  if (cr != CoderResult.UNDERFLOW) {
    throw new IOException("Encoding error");
}
}
origin: javaee/grizzly

/**
 * Sets the <tt>DataChunk</tt> end position.
 *
 * @param end the <tt>DataChunk</tt> end position.
 */
@Override
public void setEnd(int end) {
  switch (type) {
    case Bytes:
      byteChunk.setEnd(end);
      break;
    case Buffer:
      bufferChunk.setEnd(end);
      break;
    case Chars:
      charChunk.setEnd(end);
      break;
    default:
      break;
  }
}
origin: org.glassfish.grizzly/grizzly-websockets-server

/**
 * Sets the <tt>DataChunk</tt> end position.
 *
 * @param end the <tt>DataChunk</tt> end position.
 */
@Override
public void setEnd(int end) {
  switch (type) {
    case Bytes:
      byteChunk.setEnd(end);
      break;
    case Buffer:
      bufferChunk.setEnd(end);
      break;
    case Chars:
      charChunk.setEnd(end);
      break;
    default:
      break;
  }
}
origin: javaee/grizzly

/**
 * Sets the <tt>DataChunk</tt> end position.
 *
 * @param end the <tt>DataChunk</tt> end position.
 */
@Override
public void setEnd(int end) {
  switch (type) {
    case Bytes:
      byteChunk.setEnd(end);
      break;
    case Buffer:
      bufferChunk.setEnd(end);
      break;
    case Chars:
      charChunk.setEnd(end);
      break;
    default:
      break;
  }
}
origin: javaee/grizzly

/**
 * Sets the <tt>DataChunk</tt> end position.
 *
 * @param end the <tt>DataChunk</tt> end position.
 */
@Override
public void setEnd(int end) {
  switch (type) {
    case Bytes:
      byteChunk.setEnd(end);
      break;
    case Buffer:
      bufferChunk.setEnd(end);
      break;
    case Chars:
      charChunk.setEnd(end);
      break;
    default:
      break;
  }
}
origin: org.glassfish.grizzly/grizzly-http

/**
 * Sets the <tt>DataChunk</tt> end position.
 *
 * @param end the <tt>DataChunk</tt> end position.
 */
@Override
public void setEnd(int end) {
  switch (type) {
    case Bytes:
      byteChunk.setEnd(end);
      break;
    case Buffer:
      bufferChunk.setEnd(end);
      break;
    case Chars:
      charChunk.setEnd(end);
      break;
    default:
      break;
  }
}
origin: javaee/grizzly

/**
 * Sets the <tt>DataChunk</tt> end position.
 *
 * @param end the <tt>DataChunk</tt> end position.
 */
@Override
public void setEnd(int end) {
  switch (type) {
    case Bytes:
      byteChunk.setEnd(end);
      break;
    case Buffer:
      bufferChunk.setEnd(end);
      break;
    case Chars:
      charChunk.setEnd(end);
      break;
    default:
      break;
  }
}
origin: javaee/grizzly

/**
 * Sets the <tt>DataChunk</tt> end position.
 *
 * @param end the <tt>DataChunk</tt> end position.
 */
@Override
public void setEnd(int end) {
  switch (type) {
    case Bytes:
      byteChunk.setEnd(end);
      break;
    case Buffer:
      bufferChunk.setEnd(end);
      break;
    case Chars:
      charChunk.setEnd(end);
      break;
    default:
      break;
  }
}
origin: javaee/grizzly

/**
 * Sets the <tt>DataChunk</tt> end position.
 *
 * @param end the <tt>DataChunk</tt> end position.
 */
@Override
public void setEnd(int end) {
  switch (type) {
    case Bytes:
      byteChunk.setEnd(end);
      break;
    case Buffer:
      bufferChunk.setEnd(end);
      break;
    case Chars:
      charChunk.setEnd(end);
      break;
    default:
      break;
  }
}
origin: javaee/grizzly

/**
 * Sets the <tt>DataChunk</tt> end position.
 *
 * @param end the <tt>DataChunk</tt> end position.
 */
@Override
public void setEnd(int end) {
  switch (type) {
    case Bytes:
      byteChunk.setEnd(end);
      break;
    case Buffer:
      bufferChunk.setEnd(end);
      break;
    case Chars:
      charChunk.setEnd(end);
      break;
    default:
      break;
  }
}
origin: org.glassfish.grizzly/grizzly-http-server-core

/**
 * Sets the <tt>DataChunk</tt> end position.
 *
 * @param end the <tt>DataChunk</tt> end position.
 */
@Override
public void setEnd(int end) {
  switch (type) {
    case Bytes:
      byteChunk.setEnd(end);
      break;
    case Buffer:
      bufferChunk.setEnd(end);
      break;
    case Chars:
      charChunk.setEnd(end);
      break;
    default:
      break;
  }
}
origin: javaee/grizzly

/**
 * Unescapes any double quotes in the given cookie value.
 *
 * @param bc The cookie value to modify
 */
public static void unescapeDoubleQuotes(final ByteChunk bc) {
  if (bc == null || bc.getLength() == 0) {
    return;
  }
  int src = bc.getStart();
  int end = bc.getEnd();
  int dest = src;
  final byte[] buffer = bc.getBuffer();
  while (src < end) {
    if (buffer[src] == '\\' && src < end && buffer[src + 1] == '"') {
      src++;
    }
    buffer[dest] = buffer[src];
    dest++;
    src++;
  }
  bc.setEnd(dest);
}
origin: javaee/grizzly

/**
 * Unescapes any double quotes in the given cookie value.
 *
 * @param bc The cookie value to modify
 */
public static void unescapeDoubleQuotes(final ByteChunk bc) {
  if (bc == null || bc.getLength() == 0) {
    return;
  }
  int src = bc.getStart();
  int end = bc.getEnd();
  int dest = src;
  final byte[] buffer = bc.getBuffer();
  while (src < end) {
    if (buffer[src] == '\\' && src < end && buffer[src + 1] == '"') {
      src++;
    }
    buffer[dest] = buffer[src];
    dest++;
    src++;
  }
  bc.setEnd(dest);
}
origin: javaee/grizzly

/**
 * Unescapes any double quotes in the given cookie value.
 *
 * @param bc The cookie value to modify
 */
public static void unescapeDoubleQuotes(final ByteChunk bc) {
  if (bc == null || bc.getLength() == 0) {
    return;
  }
  int src = bc.getStart();
  int end = bc.getEnd();
  int dest = src;
  final byte[] buffer = bc.getBuffer();
  while (src < end) {
    if (buffer[src] == '\\' && src < end && buffer[src + 1] == '"') {
      src++;
    }
    buffer[dest] = buffer[src];
    dest++;
    src++;
  }
  bc.setEnd(dest);
}
origin: javaee/grizzly

/**
 * Unescapes any double quotes in the given cookie value.
 *
 * @param bc The cookie value to modify
 */
public static void unescapeDoubleQuotes(final ByteChunk bc) {
  if (bc == null || bc.getLength() == 0) {
    return;
  }
  int src = bc.getStart();
  int end = bc.getEnd();
  int dest = src;
  final byte[] buffer = bc.getBuffer();
  while (src < end) {
    if (buffer[src] == '\\' && src < end && buffer[src + 1] == '"') {
      src++;
    }
    buffer[dest] = buffer[src];
    dest++;
    src++;
  }
  bc.setEnd(dest);
}
org.glassfish.grizzly.http.utilByteChunksetEnd

Popular methods of ByteChunk

  • getBuffer
    Returns the message bytes.
  • getEnd
  • getStart
    Returns the start offset of the bytes. For output this is the end of the buffer.
  • <init>
  • append
    Add data to the buffer
  • getBytes
    Returns the message bytes.
  • getLength
    Returns the length of the bytes. XXX need to clean this up
  • indexOf
  • setBytes
    Sets the message bytes to the specified sub-array of bytes.
  • toString
  • allocate
  • canGrow
  • allocate,
  • canGrow,
  • delete,
  • equals,
  • equalsIgnoreCase,
  • equalsIgnoreCaseLowerCase,
  • flushBuffer,
  • getCharset,
  • getInt

Popular in Java

  • Start an intent from android
  • startActivity (Activity)
  • getSystemService (Context)
  • getResourceAsStream (ClassLoader)
  • Component (java.awt)
    A component is an object having a graphical representation that can be displayed on the screen and t
  • GridBagLayout (java.awt)
    The GridBagLayout class is a flexible layout manager that aligns components vertically and horizonta
  • Connection (java.sql)
    A connection represents a link from a Java application to a database. All SQL statements and results
  • TimeZone (java.util)
    TimeZone represents a time zone offset, and also figures out daylight savings. Typically, you get a
  • Collectors (java.util.stream)
  • JPanel (javax.swing)
  • CodeWhisperer 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