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

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

There is a newer version: 0.8.11
Show newest version
package com.google.sitebricks.client.transport;

import org.apache.commons.io.IOUtils;

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

/**
 * @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) IOUtils.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