java.io.ByteArrayInputStream.markSupported()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(6.7k)|赞(0)|评价(0)|浏览(185)

本文整理了Java中java.io.ByteArrayInputStream.markSupported()方法的一些代码示例,展示了ByteArrayInputStream.markSupported()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ByteArrayInputStream.markSupported()方法的具体详情如下:
包路径:java.io.ByteArrayInputStream
类名称:ByteArrayInputStream
方法名:markSupported

ByteArrayInputStream.markSupported介绍

[英]Indicates whether this stream supports the mark() and reset() methods. Returns true since this class supports these methods.
[中]指示此流是否支持mark()和reset()方法。返回true,因为此类支持这些方法。

代码示例

代码示例来源:origin: apache/hive

@Override
public boolean markSupported() {
 return getByteArrayInputStream().markSupported();
}

代码示例来源:origin: camunda/camunda-bpm-platform

/**
 * Determines the mimeType of a formatter from the getHead call.
 * This could be made protected, or a new class could be created to do
 * this type of conversion.  Currently, this is only used for the body
 * since the attachments are computed by filename.
 * Package-private for unit testing.
 * @param head any head string.
 * @return return the mime type or null for text/plain.
 */
final String contentTypeOf(String head) {
  if (!isEmpty(head)) {
    final int MAX_CHARS = 25;
    if (head.length() > MAX_CHARS) {
      head = head.substring(0, MAX_CHARS);
    }
    try {
      final String charset = getEncodingName();
      final ByteArrayInputStream in
          = new ByteArrayInputStream(head.getBytes(charset));
      assert in.markSupported() : in.getClass().getName();
      return URLConnection.guessContentTypeFromStream(in);
    } catch (final IOException IOE) {
      reportError(IOE.getMessage(), IOE, ErrorManager.FORMAT_FAILURE);
    }
  }
  return null; //text/plain
}

代码示例来源:origin: com.sun.mail/javax.mail

/**
 * Determines the mimeType of a formatter from the getHead call.
 * This could be made protected, or a new class could be created to do
 * this type of conversion.  Currently, this is only used for the body
 * since the attachments are computed by filename.
 * Package-private for unit testing.
 * @param chunk any char sequence or null.
 * @return return the mime type or null for text/plain.
 */
final String contentTypeOf(CharSequence chunk) {
  if (!isEmpty(chunk)) {
    final int MAX_CHARS = 25;
    if (chunk.length() > MAX_CHARS) {
      chunk = chunk.subSequence(0, MAX_CHARS);
    }
    try {
      final String charset = getEncodingName();
      final byte[] b = chunk.toString().getBytes(charset);
      final ByteArrayInputStream in = new ByteArrayInputStream(b);
      assert in.markSupported() : in.getClass().getName();
      return URLConnection.guessContentTypeFromStream(in);
    } catch (final IOException IOE) {
      reportError(IOE.getMessage(), IOE, ErrorManager.FORMAT_FAILURE);
    }
  }
  return null; //text/plain
}

代码示例来源:origin: airlift/airship

@Override
public boolean markSupported()
{
  return stream.markSupported();
}

代码示例来源:origin: Erudika/para

@Override
public boolean markSupported() {
  return bais.markSupported();
}

代码示例来源:origin: com.hp.autonomy.aci.client/aci-api

@Override
public boolean markSupported() {
  return decryptedResponse.markSupported();
}

代码示例来源:origin: org.springframework.data/spring-data-riak

@Override
public boolean markSupported() {
 return in.markSupported();
}

代码示例来源:origin: oberasoftware/jasdb

@Override
  public boolean markSupported() {
    return inputStream.markSupported();
  }
}

代码示例来源:origin: com.erudika/para-server

@Override
public boolean markSupported() {
  return bais.markSupported();
}

代码示例来源:origin: badqiu/rapid-framework

@Override
public boolean markSupported() {
  return freemarkerProcessedInput.markSupported();
}

代码示例来源:origin: net.sf.jt400/jt400

public boolean markSupported()
{ return iStream_.markSupported (); }

代码示例来源:origin: com.facebook.presto.hive/hive-apache-jdbc

@Override
public boolean markSupported() {
 return getByteArrayInputStream().markSupported();
}

代码示例来源:origin: org.apache.hive/hive-common

@Override
public boolean markSupported() {
 return getByteArrayInputStream().markSupported();
}

代码示例来源:origin: io.prestosql.hive/hive-apache-jdbc

@Override
public boolean markSupported() {
 return getByteArrayInputStream().markSupported();
}

代码示例来源:origin: com.facebook.presto.hive/hive-apache

@Override
public boolean markSupported() {
 return getByteArrayInputStream().markSupported();
}

代码示例来源:origin: edu.berkeley.cs.shark/hive-common

@Override
public boolean markSupported() {
 return getByteArrayInputStream().markSupported();
}

代码示例来源:origin: junkdog/artemis-odb

/**
 * Tests if this input stream supports the <code>mark</code> and
 * <code>reset</code> methods. Whether or not <code>mark</code> and
 * <code>reset</code> are supported is an invariant property of a
 * particular input stream instance. The <code>markSupported</code> method
 * of <code>InputStream</code> returns <code>false</code>.
 *
 * @return <code>true</code> if this stream instance supports the mark
 * and reset methods; <code>false</code> otherwise.
 * @see java.io.InputStream#mark(int)
 * @see java.io.InputStream#reset()
 */
public static boolean isMarkSupported(InputStream is) {
  ensureIsByteArrayInputStream(is);
  return ((ByteArrayInputStream) is).markSupported();
}

代码示例来源:origin: io.snappydata/gemfire-hydra-tests

/**
 * Tests if this <code>InputStream</code> supports mark/reset. The
 * <code>markSupported</code> method of <code>ByteArrayInputStream</code>
 * always returns <code>true</code>.
 * 
 * @since JDK1.1
 */
public boolean markSupported() {
 lock.lock();
 try {
  check();
  return bis.markSupported();
 } finally {
  lock.unlock();
 }
}

代码示例来源:origin: com.sun.mail/jakarta.mail

/**
 * Determines the mimeType of a formatter from the getHead call.
 * This could be made protected, or a new class could be created to do
 * this type of conversion.  Currently, this is only used for the body
 * since the attachments are computed by filename.
 * Package-private for unit testing.
 * @param chunk any char sequence or null.
 * @return return the mime type or null for text/plain.
 */
final String contentTypeOf(CharSequence chunk) {
  if (!isEmpty(chunk)) {
    final int MAX_CHARS = 25;
    if (chunk.length() > MAX_CHARS) {
      chunk = chunk.subSequence(0, MAX_CHARS);
    }
    try {
      final String charset = getEncodingName();
      final byte[] b = chunk.toString().getBytes(charset);
      final ByteArrayInputStream in = new ByteArrayInputStream(b);
      assert in.markSupported() : in.getClass().getName();
      return URLConnection.guessContentTypeFromStream(in);
    } catch (final IOException IOE) {
      reportError(IOE.getMessage(), IOE, ErrorManager.FORMAT_FAILURE);
    }
  }
  return null; //text/plain
}

代码示例来源:origin: com.sun.mail/android-mail

/**
 * Determines the mimeType of a formatter from the getHead call.
 * This could be made protected, or a new class could be created to do
 * this type of conversion.  Currently, this is only used for the body
 * since the attachments are computed by filename.
 * Package-private for unit testing.
 * @param chunk any char sequence or null.
 * @return return the mime type or null for text/plain.
 */
final String contentTypeOf(CharSequence chunk) {
  if (!isEmpty(chunk)) {
    final int MAX_CHARS = 25;
    if (chunk.length() > MAX_CHARS) {
      chunk = chunk.subSequence(0, MAX_CHARS);
    }
    try {
      final String charset = getEncodingName();
      final byte[] b = chunk.toString().getBytes(charset);
      final ByteArrayInputStream in = new ByteArrayInputStream(b);
      assert in.markSupported() : in.getClass().getName();
      return URLConnection.guessContentTypeFromStream(in);
    } catch (final IOException IOE) {
      reportError(IOE.getMessage(), IOE, ErrorManager.FORMAT_FAILURE);
    }
  }
  return null; //text/plain
}

相关文章