okio
Code IndexAdd Codota to your IDE (free)

Best code snippets using okio(Showing top 15 results out of 324)

origin: square/okhttp

 @Override public void writeTo(BufferedSink sink) throws IOException {
  Buffer buffer = new Buffer();
  while (pipe.source().read(buffer, 8192) != -1L) {
   sink.write(buffer, buffer.size());
  }
 }
}
origin: square/okhttp

 @Override public void writeTo(BufferedSink sink) throws IOException {
  BufferedSink gzipSink = Okio.buffer(new GzipSink(sink));
  body.writeTo(gzipSink);
  gzipSink.close();
 }
};
origin: square/okhttp

/**
 * Sets the delegate of {@code timeout} to {@link Timeout#NONE} and resets its underlying timeout
 * to the default configuration. Use this to avoid unexpected sharing of timeouts between pooled
 * connections.
 */
void detachTimeout(ForwardingTimeout timeout) {
 Timeout oldDelegate = timeout.delegate();
 timeout.setDelegate(Timeout.NONE);
 oldDelegate.clearDeadline();
 oldDelegate.clearTimeout();
}
origin: square/okhttp

/** Append space-prefixed lengths to {@code writer}. */
void writeLengths(BufferedSink writer) throws IOException {
 for (long length : lengths) {
  writer.writeByte(' ').writeDecimalLong(length);
 }
}
origin: square/okhttp

int encodedLength(ByteString bytes) {
 long len = 0;
 for (int i = 0; i < bytes.size(); i++) {
  int b = bytes.getByte(i) & 0xFF;
  len += CODE_LENGTHS[b];
 }
 return (int) ((len + 7) >> 3);
}
origin: square/okhttp

 public static String basic(String username, String password, Charset charset) {
  String usernameAndPassword = username + ":" + password;
  String encoded = ByteString.encodeString(usernameAndPassword, charset).base64();
  return "Basic " + encoded;
 }
}
origin: square/okhttp

@Override public boolean equals(Object other) {
 if (other instanceof Header) {
  Header that = (Header) other;
  return this.name.equals(that.name)
    && this.value.equals(that.value);
 }
 return false;
}
origin: square/okhttp

@Override public int hashCode() {
 int result = 17;
 result = 31 * result + name.hashCode();
 result = 31 * result + value.hashCode();
 return result;
}
origin: square/okhttp

/** Waits for an OAuth session for this client to be set. */
public synchronized void awaitAccessToken(Timeout timeout) throws InterruptedIOException {
 while (session == null) {
  timeout.waitUntilNotified(this);
 }
}
origin: square/okhttp

 @Override public void writeTo(BufferedSink sink) throws IOException {
  sink.writeAll(pipe.source());
 }
}
origin: square/okhttp

 @Override public void writeTo(BufferedSink sink) throws IOException {
  buffer.copyTo(sink.buffer(), 0, buffer.size());
 }
}
origin: square/okhttp

@Override public boolean onData(int streamId, BufferedSource source, int byteCount,
  boolean last) throws IOException {
 source.skip(byteCount);
 return true;
}
origin: square/okhttp

Reader(int headerTableSizeSetting, int maxDynamicTableByteCount, Source source) {
 this.headerTableSizeSetting = headerTableSizeSetting;
 this.maxDynamicTableByteCount = maxDynamicTableByteCount;
 this.source = Okio.buffer(source);
}
origin: square/okhttp

private static void writeMedium(BufferedSink sink, int i) throws IOException {
 sink.writeByte((i >>> 16) & 0xff);
 sink.writeByte((i >>> 8) & 0xff);
 sink.writeByte(i & 0xff);
}
origin: square/okhttp

public Header(ByteString name, ByteString value) {
 this.name = name;
 this.value = value;
 this.hpackSize = 32 + name.size() + value.size();
}
okio

Most used classes

  • Buffer
    A collection of bytes in memory.Moving data from one buffer to another is fast. Instead of copying b
  • ByteString
    An immutable sequence of bytes.Byte strings compare lexicographically as a sequence of unsigned byte
  • BufferedSink
    A sink that keeps a buffer internally so that callers can do small writes without a performance pena
  • BufferedSource
    A source that keeps a buffer internally so that callers can do small reads without a performance pen
  • Okio
    Essential APIs for working with Okio.
  • GzipSink,
  • Source,
  • GzipSource,
  • Sink,
  • Buffer$UnsafeCursor,
  • DeflaterSink,
  • ForwardingTimeout,
  • InflaterSource,
  • Options,
  • Pipe,
  • Utf8,
  • AsyncTimeout$Watchdog,
  • AsyncTimeout,
  • Base64

For IntelliJ IDEA,
Android Studio or Eclipse

  • Codota IntelliJ IDEA pluginCodota Android Studio pluginCode IndexSign in
  • EnterpriseFAQAboutContact Us
  • Terms of usePrivacy policyCodeboxFind Usages
Add Codota to your IDE (free)