Tabnine Logo
InputRepresentation
Code IndexAdd Tabnine to your IDE (free)

How to use
InputRepresentation
in
org.restlet.representation

Best Java code snippets using org.restlet.representation.InputRepresentation (Showing top 20 results out of 315)

origin: org.restlet.osgi/org.restlet

/**
 * Returns the representation wrapping the given stream.
 * 
 * @param stream
 *            The response input stream.
 * @return The wrapping representation.
 */
protected Representation getRepresentation(InputStream stream) {
  return new InputRepresentation(stream, null);
}
origin: org.restlet.osgi/org.restlet

/**
 * Sets the input stream to use.
 * 
 * @param stream
 *            The input stream to use.
 */
public void setStream(InputStream stream) {
  this.stream = stream;
  setAvailable(stream != null);
}
origin: DeviceConnect/DeviceConnect-Android

/**
 * Constructor.
 * 
 * @param inputStream
 *            The representation's stream.
 * @param mediaType
 *            The representation's media type.
 * @param expectedSize
 *            The expected input stream size.
 */
public InputRepresentation(InputStream inputStream, MediaType mediaType,
    long expectedSize) {
  super(mediaType);
  setSize(expectedSize);
  setTransient(true);
  setStream(inputStream);
}
origin: net.smartcosmos/smartcosmos-java-client

InputRepresentation inputRepresentation = new InputRepresentation(inputStream, mediaType);
inputRepresentation.setMediaType(MediaType.APPLICATION_OCTET_STREAM);
origin: org.restlet.osgi/org.restlet

@Override
public InputStream getStream() throws IOException {
  if (Edition.CURRENT != Edition.GWT) {
    final InputStream result = this.stream;
    setStream(null);
    return result;
  }
  return this.stream;
}
origin: DeviceConnect/DeviceConnect-Android

  @Override
  public InputStream getStream() throws IOException {
//        if (Edition.CURRENT != Edition.GWT) {
      final InputStream result = this.stream;
      setStream(null);
      return result;
//        }
//
//        return this.stream;
  }

origin: org.restlet/org.restlet.ext.servlet

@Override
public Representation getRepresentation(MediaType defaultMediaType,
    int timeToLive) {
  final InputStream ris = getServletContext().getResourceAsStream(path);
  return (ris == null) ? null : new InputRepresentation(ris,
      defaultMediaType);
}
origin: org.restlet.osgi/org.restlet

/**
 * Constructor.
 * 
 * @param inputStream
 *            The representation's stream.
 * @param mediaType
 *            The representation's media type.
 * @param expectedSize
 *            The expected input stream size.
 */
public InputRepresentation(InputStream inputStream, MediaType mediaType,
    long expectedSize) {
  super(mediaType);
  setSize(expectedSize);
  setTransient(true);
  setStream(inputStream);
}
origin: DeviceConnect/DeviceConnect-Android

/**
 * Sets the input stream to use.
 * 
 * @param stream
 *            The input stream to use.
 */
public void setStream(InputStream stream) {
  this.stream = stream;
  setAvailable(stream != null);
}
origin: org.umlg/runtime-restlet

@Override
protected Representation get() throws ResourceException {
  String path = UmlgURLDecoder.decode(getQueryValue("path"));
  if (path.endsWith("SVG") || path.endsWith("svg")) {
    return new InputRepresentation(Thread.currentThread().getContextClassLoader().getResourceAsStream(path), MediaType.IMAGE_SVG);
  } else {
    return new InputRepresentation(Thread.currentThread().getContextClassLoader().getResourceAsStream(path), MediaType.IMAGE_PNG);
  }
}
origin: org.restlet.jee/org.restlet.ext.jaxrs

@Override
public void setInputStream(InputStream stream) {
  getRequest().setEntity(new InputRepresentation(stream));
}
origin: org.restlet.jee/org.restlet.ext.jaxrs

/**
 * @param mediaType
 * @param entityStream
 * @return
 */
static Form getForm(MediaType mediaType, InputStream entityStream) {
  Form form = new Form(new InputRepresentation(entityStream, toRestletMediaType(mediaType)));
  Request.getCurrent().setEntity(form.getWebRepresentation());
  return form;
}
origin: org.restlet.jee/org.restlet.ext.jaxrs

@Override
public Object readFrom(Class<Object> type, Type genericType,
    Annotation[] annotations, MediaType mediaType,
    MultivaluedMap<String, String> httpHeaders, InputStream entityStream)
    throws IOException {
  Representation sourceRepresentation = new InputRepresentation(entityStream, toRestletMediaType(mediaType));
  return getConverterService().toObject(sourceRepresentation, type, null);
}
origin: org.restlet.jse/org.restlet.example

  @Put
  public String store(Representation input) throws Exception {
    // Create a factory for disk-based file items
    RestletFileUpload fileUpload = new RestletFileUpload(
        new DiskFileItemFactory());
    List<FileItem> fileItems = fileUpload.parseRepresentation(input);

    for (FileItem fileItem : fileItems) {
      if (fileItem.isFormField()) {
        System.out.println(fileItem.getFieldName() + "="
            + fileItem.getString());
      } else {
        Representation attachment = new InputRepresentation(
            fileItem.getInputStream());
        attachment.write(System.out);
      }
    }

    return "Mail updated!";
  }
}
origin: org.restlet.jse/org.restlet.example

  @Put
  public String store(Representation input) throws Exception {
    // Create a factory for disk-based file items
    RestletFileUpload fileUpload = new RestletFileUpload(
        new DiskFileItemFactory());
    List<FileItem> fileItems = fileUpload.parseRepresentation(input);

    for (FileItem fileItem : fileItems) {
      if (fileItem.isFormField()) {
        System.out.println(fileItem.getFieldName() + "="
            + fileItem.getString());
      } else {
        Representation attachment = new InputRepresentation(
            fileItem.getInputStream());
        attachment.write(System.out);
      }
    }

    return "Mail updated!";
  }
}
origin: org.xwiki.platform/xwiki-platform-annotation-rest

  new InputRepresentation(entityStream, org.restlet.data.MediaType.APPLICATION_WWW_FORM);
Form form = new Form(representation);
origin: org.restlet.osgi/org.restlet

  result = source.getStream();
} else if (InputRepresentation.class.isAssignableFrom(target)) {
  result = new InputRepresentation(source.getStream());
} else if (Reader.class.isAssignableFrom(target)) {
  result = source.getReader();
origin: org.restlet.osgi/org.restlet.ext.osgi

Representation output = new InputRepresentation(
    url.openStream(),
    metadataService.getDefaultMediaType());
origin: org.restlet.osgi/org.restlet

Representation output = new InputRepresentation(
    inputStream,
    metadataService.getDefaultMediaType());
origin: org.restlet.jee/org.restlet.ext.wadl

InputRepresentation xslRep = new InputRepresentation(
    wadl2htmlXsltUrl.openStream(),
    MediaType.APPLICATION_W3C_XSLT);
org.restlet.representationInputRepresentation

Javadoc

Transient representation based on a BIO input stream.

Most used methods

  • <init>
    Constructor.
  • setAvailable
  • setSize
  • setStream
    Sets the input stream to use.
  • setTransient
  • getCharacterSet
  • getStream
  • setMediaType

Popular in Java

  • Finding current android device location
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • onRequestPermissionsResult (Fragment)
  • getResourceAsStream (ClassLoader)
  • FileReader (java.io)
    A specialized Reader that reads from a file in the file system. All read requests made by calling me
  • Runnable (java.lang)
    Represents a command that can be executed. Often used to run code in a different Thread.
  • SocketTimeoutException (java.net)
    This exception is thrown when a timeout expired on a socket read or accept operation.
  • Format (java.text)
    The base class for all formats. This is an abstract base class which specifies the protocol for clas
  • Reference (javax.naming)
  • Runner (org.openjdk.jmh.runner)
  • Top plugins for Android Studio
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