コード例 #1
0
  @Override
  protected ContentMetaData buildResourceMetaData(
      VariableContainer variableContainer, ResourceParameter... resourceParameters)
      throws Exception {
    SimpleContentMetaData resourceMetaData = new SimpleContentMetaData(getResourceURI());
    resourceMetaData.addSupportedAttribute(Attributes.exists, Attributes.readable);
    resourceMetaData.setValue(Attributes.exists, true);
    resourceMetaData.setValue(Attributes.readable, true);

    return resourceMetaData;
  }
コード例 #2
0
 @Override
 public OutputStream getOutputStream(
     VariableContainer variableContainer, ResourceParameter... resourceParameters)
     throws Exception {
   advanceState(State.OPEN, variableContainer, resourceParameters);
   outputMetaData = new SimpleContentMetaData(getResourceURI());
   URL url = new URL(getResourceURI().getBaseURI());
   return outputMetaData.wrapOutputStream(url.openConnection().getOutputStream());
 }
コード例 #3
0
  @Override
  public boolean next(VariableContainer variableContainer, ResourceParameter... resourceParameters)
      throws Exception {
    advanceState(State.OPEN, variableContainer, resourceParameters);
    if (getResourceState() == State.OPEN) {

      contentMetaData = new SimpleContentMetaData(getResourceURI());
      URL url = new URL(getResourceURI().getBaseURI());
      InputStream inputStream =
          contentMetaData.wrapInputStream(url.openConnection().getInputStream());
      content = contentMetaData.readInputStream(inputStream, true);
      setResourceState(State.STEPPING);
      return true;
    } else {
      setResourceState(State.OPEN);
      return false;
    }
  }