org.modeshape.web.jcr.rest.client.json

## Class FileNode

- java.lang.Object
- - org.codehaus.jettison.json.JSONObject
  - - org.modeshape.web.jcr.rest.client.json.JsonNode
    - - org.modeshape.web.jcr.rest.client.json.FileNode

- All Implemented Interfaces:
    Serializable

      @Immutable
      public final class FileNode
      extends JsonNode

  The `FileNode` class is responsible for knowing how to create a URL for a file, create a JSON representation of a file, and to create the appropriate JCR nodes for a file.
  See Also:
    Serialized Form

- - ### Field Summary

    - ### Fields inherited from class org.codehaus.jettison.json.JSONObject

      `NULL`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `FileNode(Workspace workspace, String path, File file)`
    `FileNode(Workspace workspace, String path, File file, boolean versionable)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `byte[]` | `getContent()`
    `String` | `getPath()`
    `URL` | `getUrl()`

    - ### Methods inherited from class org.modeshape.web.jcr.rest.client.json.JsonNode

      `children, getId, properties, toString, withChild, withMixin, withPrimaryType, withProperty`

    - ### Methods inherited from class org.codehaus.jettison.json.JSONObject

      `accumulate, append, doubleToString, get, getBoolean, getDouble, getInt, getJSONArray, getJSONObject, getLong, getString, has, isNull, keys, length, names, numberToString, opt, optBoolean, optBoolean, optDouble, optDouble, optInt, optInt, optJSONArray, optJSONObject, optLong, optLong, optString, optString, put, put, put, put, put, put, put, putOpt, quote, remove, toJSONArray, toString, write`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### FileNode

          public FileNode(Workspace workspace,
                  String path,
                  File file)
                   throws Exception

      Parameters:
        `workspace` - the workspace being used (never `null`)
        `path` - the path in the workspace (never `null`)
        `file` - the file on the local file system (never `null`)
      Throws:
        `Exception` - if there is a problem constructing the file node

    - #### FileNode

          public FileNode(Workspace workspace,
                  String path,
                  File file,
                  boolean versionable)
                   throws Exception

      Parameters:
        `workspace` - the workspace being used (never `null`)
        `path` - the path in the workspace (never `null`)
        `file` - the file on the local file system (never `null`)
        `versionable` - true if the file node should be versionable
      Throws:
        `Exception` - if there is a problem constructing the file node

  - ### Method Detail

    - #### getContent

          public byte[] getContent()
                            throws Exception

      Overrides:
        `getContent` in class `JsonNode`
      Returns:
        the content that gets published
      Throws:
        `Exception` - if there is a problem obtaining the node content
      See Also:
        `JsonNode.getContent()`

    - #### getPath

          public String getPath()

      Returns:
        the path where the file is or will be published or unpublished

    - #### getUrl

          public URL getUrl()
                     throws Exception

      Specified by:
        `getUrl` in class `JsonNode`
      Returns:
        an HTTP URL representing this node
      Throws:
        `Exception` - if there is a problem constructing the URL
      See Also:
        `JsonNode.getUrl()`

Copyright © 2008-2014 JBoss, a division of Red Hat. All Rights Reserved.