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

x33g5p2x  于2022-01-28 转载在 其他  
字(5.8k)|赞(0)|评价(0)|浏览(109)

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

Reader.markSupported介绍

[英]Indicates whether this reader supports the mark() and reset() methods. This default implementation returns false.
[中]指示此读取器是否支持mark()和reset()方法。此默认实现返回false。

代码示例

代码示例来源:origin: commons-io/commons-io

/**
 * Invokes the delegate's <code>markSupported()</code> method.
 * @return true if mark is supported, otherwise false
 */
@Override
public boolean markSupported() {
  return in.markSupported();
}

代码示例来源:origin: igniterealtime/Smack

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

代码示例来源:origin: org.apache.ant/ant

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

代码示例来源:origin: org.apache.commons/commons-io

/** @see java.io.Reader#markSupported() */
public boolean markSupported() {
  return in.markSupported();
}

代码示例来源:origin: robovm/robovm

/**
 * Indicates whether this reader supports {@code mark()} and {@code reset()}.
 * This implementation returns whether the filtered reader supports marking.
 *
 * @return {@code true} if {@code mark()} and {@code reset()} are supported
 *         by the filtered reader, {@code false} otherwise.
 * @see #mark(int)
 * @see #reset()
 * @see #skip(long)
 */
@Override
public boolean markSupported() {
  synchronized (lock) {
    return in.markSupported();
  }
}

代码示例来源:origin: ltsopensource/light-task-scheduler

public JSONTokenizer(Reader reader) {
  this.reader = reader.markSupported()
      ? reader
      : new BufferedReader(reader);
  this.eof = false;
  this.usePrevious = false;
  this.previous = 0;
  this.index = 0;
  this.character = 1;
  this.line = 1;
}

代码示例来源:origin: ltsopensource/light-task-scheduler

public JSONTokenizer(Reader reader) {
  this.reader = reader.markSupported()
      ? reader
      : new BufferedReader(reader);
  this.eof = false;
  this.usePrevious = false;
  this.previous = 0;
  this.index = 0;
  this.character = 1;
  this.line = 1;
}

代码示例来源:origin: Activiti/Activiti

/**
 * Construct a JSONTokener from a reader.
 * 
 * @param reader
 *          A reader.
 */
public JSONTokener(Reader reader) {
 this.reader = reader.markSupported() ? reader : new BufferedReader(reader);
 this.eof = false;
 this.usePrevious = false;
 this.previous = 0;
 this.index = 0;
 this.character = 1;
 this.line = 1;
}

代码示例来源:origin: looly/hutool

/**
 * 从Reader中构建
 * 
 * @param reader Reader
 */
public JSONTokener(Reader reader) {
  this.reader = reader.markSupported() ? reader : new BufferedReader(reader);
  this.eof = false;
  this.usePrevious = false;
  this.previous = 0;
  this.index = 0;
  this.character = 1;
  this.line = 1;
}

代码示例来源:origin: looly/hutool

/**
 * 从Reader中构建
 * 
 * @param reader Reader
 */
public JSONTokener(Reader reader) {
  this.reader = reader.markSupported() ? reader : new BufferedReader(reader);
  this.eof = false;
  this.usePrevious = false;
  this.previous = 0;
  this.index = 0;
  this.character = 1;
  this.line = 1;
}

代码示例来源:origin: zzz40500/GsonFormat

/**
 * Construct a JSONTokener from a Reader.
 *
 * @param reader     A reader.
 */
public JSONTokener(Reader reader) {
  this.reader = reader.markSupported()
    ? reader
    : new BufferedReader(reader);
  this.eof = false;
  this.usePrevious = false;
  this.previous = 0;
  this.index = 0;
  this.character = 1;
  this.line = 1;
}

代码示例来源:origin: alibaba/mdrill

/**
 * Construct a JSONTokener from a reader.
 *
 * @param reader     A reader.
 */
public JSONTokener(Reader reader) {
  this.reader = reader.markSupported() ? 
      reader : new BufferedReader(reader);
  this.eof = false;
  this.usePrevious = false;
  this.previous = 0;
  this.index = 0;
  this.character = 1;
  this.line = 1;
}

代码示例来源:origin: primefaces/primefaces

/**
 * Construct a JSONTokener from a Reader.
 *
 * @param reader     A reader.
 */
public JSONTokener(Reader reader) {
  this.reader = reader.markSupported()
    ? reader
    : new BufferedReader(reader);
  this.eof = false;
  this.usePrevious = false;
  this.previous = 0;
  this.index = 0;
  this.character = 1;
  this.line = 1;
}

代码示例来源:origin: jersey/jersey

private static Reader ensureNonEmptyReader(Reader reader) throws XMLStreamException {
  try {
    Reader mr = reader.markSupported() ? reader : new BufferedReader(reader);
    mr.mark(1);
    if (mr.read() == -1) {
      throw new XMLStreamException("JSON expression can not be empty!");
    }
    mr.reset();
    return mr;
  } catch (IOException ex) {
    throw new XMLStreamException(ex);
  }
}

代码示例来源:origin: com.h2database/h2

private void initRead() throws IOException {
  if (input == null) {
    try {
      InputStream in = FileUtils.newInputStream(fileName);
      in = new BufferedInputStream(in, Constants.IO_BUFFER_SIZE);
      input = new InputStreamReader(in, characterSet);
    } catch (IOException e) {
      close();
      throw e;
    }
  }
  if (!input.markSupported()) {
    input = new BufferedReader(input);
  }
  input.mark(1);
  int bom = input.read();
  if (bom != 0xfeff) {
    // Microsoft Excel compatibility
    // ignore pseudo-BOM
    input.reset();
  }
  inputBuffer = new char[Constants.IO_BUFFER_SIZE * 2];
  if (columnNames == null) {
    readHeader();
  }
}

代码示例来源:origin: neo4j/neo4j

@Override
public boolean markSupported()
{
  adversary.injectFailure();
  return reader.markSupported();
}

代码示例来源:origin: org.jsoup/jsoup

public CharacterReader(Reader input, int sz) {
  Validate.notNull(input);
  Validate.isTrue(input.markSupported());
  reader = input;
  charBuf = new char[sz > maxBufferLen ? maxBufferLen : sz];
  bufferUp();
}

代码示例来源:origin: commons-io/commons-io

@Test
public void testMarkSupported() throws Exception {
  final Reader reader = new CharSequenceReader("FooBar");
  assertTrue(reader.markSupported());
  reader.close();
}

代码示例来源:origin: commons-io/commons-io

@Test
public void testMarkNotSupported() throws Exception {
  final Reader reader = new TestNullReader(100, false, true);
  assertFalse("Mark Should NOT be Supported", reader.markSupported());
  try {
    reader.mark(5);
    fail("mark() should throw UnsupportedOperationException");
  } catch (final UnsupportedOperationException e) {
    assertEquals("mark() error message",  "Mark not supported", e.getMessage());
  }
  try {
    reader.reset();
    fail("reset() should throw UnsupportedOperationException");
  } catch (final UnsupportedOperationException e) {
    assertEquals("reset() error message",  "Mark not supported", e.getMessage());
  }
  reader.close();
}

代码示例来源:origin: commons-io/commons-io

final Reader reader = new TestNullReader(100, true, false);
assertTrue("Mark Should be Supported", reader.markSupported());

相关文章

微信公众号

最新文章

更多