/*
(non-Javadoc)
@see org.springframework.http.converter.json.MappingJackson2HttpMessageConverter#canRead(java.lang.Class, org.springframework.http.MediaType)
977927
@Override
	public boolean canRead(Class<?> clazz, @Nullable MediaType mediaType) {
		return type.isAssignableFrom(clazz) && super.canRead(clazz, mediaType);
	}
1025568
def can_read(self, timeout=0):
        ""
        sock = self._sock
        if not sock:
            self.connect()
            sock = self._sock
        return self._parser.can_read() or self._selector.can_read(timeout)
557855
protected Object readResponse(Type returnType, JsonNode jsonObject) throws Throwable {
		return readResponse(returnType, jsonObject, null);
	}
1246550
protected <T> T readReadable(Class<T> clazz) throws IOException {
      try {
         T object = Reflect.onClass(clazz).allowPrivilegedAccess().create().get();
         JsonSerializable readable = Cast.as(object);
         boolean isArray = JsonArraySerializable.class.isAssignableFrom(clazz);//(object instanceof ArrayValue);
         if (isArray && peek() == JsonTokenType.BEGIN_ARRAY) {
            beginArray();
         } else if (peek() == JsonTokenType.BEGIN_OBJECT) {
            beginObject();
         }
         readable.fromJson(this);
         if (isArray && peek() == JsonTokenType.END_ARRAY) {
            endArray();
         } else if (peek() == JsonTokenType.END_OBJECT) {
            endObject();
         }
         return object;
      } catch (ReflectionException e) {
         throw new IOException(e);
      }
   }
175939
public static <T> T readEntity(Class<T> rawType, PropertiesDelegate propertiesDelegate) {
        return getRequest().readEntity(rawType, propertiesDelegate);
    }
1300739
public function canRead()
    {
        $actor = pick($this->actor, get_viewer());

        //if repository is ownable then ask the actor if viewer can publish things
        if (
            in_array($this->getRequest()->get('layout'), array('add', 'edit', 'form', 'composer'))
        ) {
            $result = ($this->getItem()) ? $this->canEdit() : $this->canAdd();

            return $result;
        }

        if (!$this->getItem()) {
            return false;
        }

        //check if an entiy authorize access
        return $this->getItem()->authorize('access');
    }
931822
public static Object convertTextToText(Object source, MediaType sourceType, MediaType destinationType) {
      if (source == null) return null;
      if (sourceType == null) throw new NullPointerException("MediaType cannot be null!");
      if (!sourceType.match(MediaType.TEXT_PLAIN)) throw log.invalidMediaType(TEXT_PLAIN_TYPE, sourceType.toString());

      boolean asString = destinationType.hasStringType();

      Charset sourceCharset = sourceType.getCharset();
      Charset destinationCharset = destinationType.getCharset();
      if (sourceCharset.equals(destinationCharset)) return convertTextClass(source, destinationType, asString);
      byte[] byteContent = source instanceof byte[] ? (byte[]) source : source.toString().getBytes(sourceCharset);
      return convertTextClass(convertCharset(byteContent, sourceCharset, destinationCharset), destinationType, asString);
   }
671720
@Override
    public boolean canImport(String mediaType) {
        return (MediaType.NATIVE_MEDIATYPE_SYNTAX_MAP.containsKey(mediaType) ||
                this.serviceTransformationEngine.canTransform(mediaType));
    }
674337
@SuppressWarnings("unchecked")
    public static <T> T parse(Reader reader, Class<T> type,
                              Converter<Object, Map<String, Object>> mc) throws IOException,
            ParseException {
        return (T) parse(reader, new JSONVisitor(type, new JSONValue(mc), mc),
                JSONToken.ANY);
    }
920632
public boolean canRead() throws SftpStatusException, SshException {
		// This is long hand because gcj chokes when it is not? Investigate why
		if ((getAttributes().getPermissions().longValue() & SftpFileAttributes.S_IRUSR) == SftpFileAttributes.S_IRUSR
				|| (getAttributes().getPermissions().longValue() & SftpFileAttributes.S_IRGRP) == SftpFileAttributes.S_IRGRP
				|| (getAttributes().getPermissions().longValue() & SftpFileAttributes.S_IROTH) == SftpFileAttributes.S_IROTH) {
			return true;
		}
		return false;
	}
353486
@Override
    <T> T read(Class<T> rootType) {
        try {
            try {
                return parseRemaining(rootType);
            } finally {
                input.close();
            }
        } catch (RuntimeException ex) {
            throw ex;
        } catch (Exception ex) {
            throw new RuntimeException(ex);
        }
    }
740533
public static int read(ReadableByteChannel ch, ByteBuffer bb)
        throws IOException
    {
        if (ch instanceof SelectableChannel) {
            SelectableChannel sc = (SelectableChannel)ch;
            synchronized (sc.blockingLock()) {
                boolean bm = sc.isBlocking();
                if (!bm)
                    throw new IllegalBlockingModeException();
                // Android-removed.
                // if (bm != block)
                //    sc.configureBlocking(block);
                int n = ch.read(bb);
                // Android-removed.
                // if (bm != block)
                //     sc.configureBlocking(bm);
                return n;
            }
        } else {
            return ch.read(bb);
        }
    }
665760
public <T> T read(Reader input, Class<T> rootType) {
        JodaBeanUtils.notNull(input, "input");
        JodaBeanUtils.notNull(rootType, "rootType");
        try {
            JsonInput jsonInput = new JsonInput(input);
            return parseRoot(jsonInput, rootType);
        } catch (RuntimeException ex) {
            throw ex;
        } catch (Exception ex) {
            throw new RuntimeException(ex);
        }
    }
938747
@SuppressWarnings("unchecked")
    public <T> T readBodyAs(Class<T> type) {
        if (String.class.isAssignableFrom(type)) {
            return (T)readBodyAsString();
        } else if (Number.class.isAssignableFrom(type)) {
            return (T)readBodyAsNumber((Class<Number>)type);
        } else if (Boolean.class.isAssignableFrom(type)) {
            return (T)readBodyAsBoolean();
        } else if (Character.class.isAssignableFrom(type)) {
            return (T)readBodyAsChar();
        }
        return readBodyAsObject(type);
    }
925958
public boolean canRead(String path)
  {
    try {
      ZipEntry entry = getZipEntry(path);

      return entry != null && ! entry.isDirectory();
    } catch (IOException e) {
      log.log(Level.FINE, e.toString(), e);

      return false;
    }
  }
369842
public <T> T read(final Class<T> type) throws DevFailed {
        update();
        return extract(type);
    }
574036
@Override
    public boolean isReadable(Class<?> type, Type genericType,
            Annotation[] annotations, MediaType mediaType) {
        return ODataEntity.isODataEntityType(type);
    }