All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.google.sitebricks.client.transport.ByteArrayTransport Maven / Gradle / Ivy

package com.google.sitebricks.client.transport;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;

import com.google.common.io.ByteStreams;

/**
 * @author Dhanji R. Prasanna ([email protected])
 */
class ByteArrayTransport extends Raw {

  @SuppressWarnings("unchecked")
  public  T in(InputStream in, Class type) throws IOException {
    assert type == byte[].class;
    return (T) ByteStreams.toByteArray(in);
  }

  public  void out(OutputStream out, Class type, T data) throws IOException {
    assert data instanceof byte[];
    out.write((byte[]) data);
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy