org.apache.naming.resources

## Class Resource

- java.lang.Object
- - org.apache.naming.resources.Resource

- Direct Known Subclasses:
    FileDirContext.FileResource, WARDirContext.WARResource

      public class Resource
      extends Object

  Encapsulates the contents of a resource.
  Author:
    Remy Maucherat

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected byte[]` | `binaryContent` Binary content.
    `protected InputStream` | `inputStream` Input stream.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `Resource()`
    `Resource(byte[] binaryContent)`
    `Resource(InputStream inputStream)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `byte[]` | `getContent()` Content accessor.
    `void` | `setContent(byte[] binaryContent)` Content mutator.
    `void` | `setContent(InputStream inputStream)` Content mutator.
    `InputStream` | `streamContent()` Content accessor.

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

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

- - ### Field Detail

    - #### binaryContent

          protected byte[] binaryContent

      Binary content.

    - #### inputStream

          protected InputStream inputStream

      Input stream.

  - ### Constructor Detail

    - #### Resource

          public Resource()

    - #### Resource

          public Resource(InputStream inputStream)

    - #### Resource

          public Resource(byte[] binaryContent)

  - ### Method Detail

    - #### streamContent

          public InputStream streamContent()
                                    throws IOException

      Content accessor.
      Returns:
        InputStream
      Throws:
        `IOException`

    - #### getContent

          public byte[] getContent()

      Content accessor.
      Returns:
        binary content

    - #### setContent

          public void setContent(InputStream inputStream)

      Content mutator.
      Parameters:
        `inputStream` - New input stream

    - #### setContent

          public void setContent(byte[] binaryContent)

      Content mutator.
      Parameters:
        `binaryContent` - New bin content

Copyright © 2000-2017 Apache Software Foundation. All Rights Reserved.