protected void closeStreams() {
    if (null != is) {
      try {
        is.close();
      } catch (IOException e) {
        if (Logging.REPORT_LEVEL <= Logging.INFORMATION) {
          Logging.report(
              Logging.INFORMATION,
              LogChannels.LC_MMAPI,
              "IOException in RtspConnection.closeStreams(): " + e.getMessage());
        }
      }
      is = null;
    }

    if (null != os) {
      try {
        os.close();
      } catch (IOException e) {
        if (Logging.REPORT_LEVEL <= Logging.INFORMATION) {
          Logging.report(
              Logging.INFORMATION,
              LogChannels.LC_MMAPI,
              "IOException in RtspConnection.closeStreams(): " + e.getMessage());
        }
      }
      os = null;
    }
  }
  /**
   * Check if it is known resource type by this manager. Convert it to the expected object. It
   * recognizes {@link #TYPE_STRING}, {@link #TYPE_BINARY}, {@link #TYPE_NUMBER_FORMAT_SYMBOLS},
   * {@link #TYPE_DATETIME_FORMAT_SYMBOLS}.
   *
   * @param resourceID resource identifier
   * @param type the resource type
   * @param length the resource length
   * @param reader resource bundle reader
   * @return resource as object
   * @throws IOException thrown when resource cannot be read or cannot be converted
   */
  protected Object convertToResourceType(
      int resourceID, byte type, int length, ResourceBundleReader reader) throws IOException {

    DevResourceBundleReader devReader = (DevResourceBundleReader) reader;
    if (Logging.REPORT_LEVEL <= Logging.INFORMATION) {
      Logging.report(
          Logging.INFORMATION,
          LogChannels.LC_JSR238,
          classname
              + ": converting resource id = \""
              + resourceID
              + "\" to object type :\""
              + type
              + "\" with reader : "
              + reader);
    }

    if (type == TYPE_NUMBER_FORMAT_SYMBOLS) {
      NumberFormatSymbols nfs = new NumberFormatSymbols();
      devReader.deserializeResource(nfs, resourceID);
      if (Logging.REPORT_LEVEL <= Logging.INFORMATION) {
        Logging.report(
            Logging.INFORMATION,
            LogChannels.LC_JSR238,
            classname + ": " + "Resource type is NUMBER_FORMAT_SYMBOLS");
      }
      return nfs;
    } else if (type == TYPE_DATETIME_FORMAT_SYMBOLS) {
      DateFormatSymbols dfs = new DateFormatSymbols();
      devReader.deserializeResource(dfs, resourceID);
      if (Logging.REPORT_LEVEL <= Logging.INFORMATION) {
        Logging.report(
            Logging.INFORMATION,
            LogChannels.LC_JSR238,
            classname + ": " + "Resource type is DATETIME_FORMAT_SYMBOLS");
      }
      return dfs;
    } else {
      byte[] data = null;
      if (length != 0) {
        data = reader.getRawResourceData(resourceID);
      } else {
        data = new byte[0];
      }
      if (type == TYPE_STRING) {
        Object o = getUTF8(data);
        return o;
      } else if (type == TYPE_BINARY) {
        return data;
      }
    }
    return null;
  }
  /**
   * The method clones resource.
   *
   * @return copy of resource
   * @param resource the resource to clone
   */
  protected Object cloneResource(Object resource) {
    Object clon = super.cloneResource(resource);

    if (resource instanceof NumberFormatSymbols || resource instanceof DateFormatSymbols) {
      if (Logging.REPORT_LEVEL <= Logging.INFORMATION) {
        Logging.report(Logging.INFORMATION, LogChannels.LC_JSR238, classname + ": clone resource");
      }
      SerializableResource sr = (SerializableResource) resource;
      clon = sr.clone();
    }
    return clon;
  }