org.modeshape.common.util.IoUtil.read()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(8.5k)|赞(0)|评价(0)|浏览(122)

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

IoUtil.read介绍

[英]Read and return the entire contents of the supplied File.
[中]读取并返回所提供文件的全部内容。

代码示例

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

/**
 * Read and return the entire contents of the supplied {@link InputStream}. This method always closes the stream when finished
 * reading.
 * 
 * @param stream the streamed contents; may be null
 * @return the contents, or an empty string if the supplied stream is null
 * @throws IOException if there is an error reading the content
 */
public static String read( InputStream stream ) throws IOException {
  return IoUtil.read(stream);
}

代码示例来源:origin: ModeShape/modeshape

/**
 * Read and return the entire contents of the supplied {@link Reader}. This method always closes the reader when finished
 * reading.
 * 
 * @param reader the reader of the contents; may be null
 * @return the contents, or an empty string if the supplied reader is null
 * @throws IOException if there is an error reading the content
 */
public static String read( Reader reader ) throws IOException {
  return IoUtil.read(reader);
}

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

/**
 * Read and return the entire contents of the supplied {@link Reader}. This method always closes the reader when finished
 * reading.
 * 
 * @param reader the reader of the contents; may be null
 * @return the contents, or an empty string if the supplied reader is null
 * @throws IOException if there is an error reading the content
 */
public static String read( Reader reader ) throws IOException {
  return IoUtil.read(reader);
}

代码示例来源:origin: org.fcrepo/modeshape-common

/**
 * Read and return the entire contents of the supplied {@link Reader}. This method always closes the reader when finished
 * reading.
 * 
 * @param reader the reader of the contents; may be null
 * @return the contents, or an empty string if the supplied reader is null
 * @throws IOException if there is an error reading the content
 */
public static String read( Reader reader ) throws IOException {
  return IoUtil.read(reader);
}

代码示例来源:origin: org.fcrepo/modeshape-common

/**
 * Read and return the entire contents of the supplied {@link InputStream}. This method always closes the stream when finished
 * reading.
 * 
 * @param stream the streamed contents; may be null
 * @return the contents, or an empty string if the supplied stream is null
 * @throws IOException if there is an error reading the content
 */
public static String read( InputStream stream ) throws IOException {
  return IoUtil.read(stream);
}

代码示例来源:origin: ModeShape/modeshape

/**
 * Read and return the entire contents of the supplied {@link InputStream}. This method always closes the stream when finished
 * reading.
 * 
 * @param stream the streamed contents; may be null
 * @return the contents, or an empty string if the supplied stream is null
 * @throws IOException if there is an error reading the content
 */
public static String read( InputStream stream ) throws IOException {
  return IoUtil.read(stream);
}

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

/**
 * Read and return the entire contents of the supplied {@link InputStream}. This method always closes the stream when finished
 * reading.
 * 
 * @param stream the streamed contents; may be null
 * @return the contents, or an empty string if the supplied stream is null
 * @throws IOException if there is an error reading the content
 */
public static String read( InputStream stream ) throws IOException {
  return stream == null ? "" : read(new InputStreamReader(stream));
}

代码示例来源:origin: ModeShape/modeshape

/**
 * Read and return the entire contents of the supplied {@link InputStream}. This method always closes the stream when finished
 * reading.
 * 
 * @param stream the streamed contents; may be null
 * @return the contents, or an empty string if the supplied stream is null
 * @throws IOException if there is an error reading the content
 */
public static String read( InputStream stream ) throws IOException {
  return stream == null ? "" : read(new InputStreamReader(stream));
}

代码示例来源:origin: org.fcrepo/modeshape-common

/**
 * Read and return the entire contents of the supplied {@link InputStream}. This method always closes the stream when finished
 * reading.
 * 
 * @param stream the streamed contents; may be null
 * @return the contents, or an empty string if the supplied stream is null
 * @throws IOException if there is an error reading the content
 */
public static String read( InputStream stream ) throws IOException {
  return stream == null ? "" : read(new InputStreamReader(stream));
}

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

/**
 * Read and return the entire contents of the supplied {@link InputStream}. This method always closes the stream when finished
 * reading.
 * 
 * @param stream the streamed contents; may be null
 * @param charset charset of the stream data; may not be null
 * @return the contents, or an empty string if the supplied stream is null
 * @throws IOException if there is an error reading the content
 */
public static String read( InputStream stream,
              String charset ) throws IOException {
  return stream == null ? "" : read(new InputStreamReader(stream, charset));
}

代码示例来源:origin: org.fcrepo/modeshape-common

/**
 * Read and return the entire contents of the supplied {@link InputStream}. This method always closes the stream when finished
 * reading.
 * 
 * @param stream the streamed contents; may be null
 * @param charset charset of the stream data; may not be null
 * @return the contents, or an empty string if the supplied stream is null
 * @throws IOException if there is an error reading the content
 */
public static String read( InputStream stream,
              String charset ) throws IOException {
  return stream == null ? "" : read(new InputStreamReader(stream, charset));
}

代码示例来源:origin: ModeShape/modeshape

/**
 * Read and return the entire contents of the supplied {@link InputStream}. This method always closes the stream when finished
 * reading.
 * 
 * @param stream the streamed contents; may be null
 * @param charset charset of the stream data; may not be null
 * @return the contents, or an empty string if the supplied stream is null
 * @throws IOException if there is an error reading the content
 */
public static String read( InputStream stream,
              String charset ) throws IOException {
  return stream == null ? "" : read(new InputStreamReader(stream, charset));
}

代码示例来源:origin: org.fcrepo/modeshape-jcr

/**
 * Import the CND content from the supplied stream, placing the content into the importer's destination.
 * 
 * @param file the file containing the CND content
 * @param problems where any problems encountered during import should be reported
 * @throws IOException if there is a problem reading from the supplied stream
 */
public void importFrom( File file,
            Problems problems ) throws IOException {
  importFrom(IoUtil.read(file), problems, file.getCanonicalPath());
}

代码示例来源:origin: ModeShape/modeshape

/**
 * Import the CND content from the supplied stream, placing the content into the importer's destination.
 * 
 * @param file the file containing the CND content
 * @param problems where any problems encountered during import should be reported
 * @throws IOException if there is a problem reading from the supplied stream
 */
public void importFrom( File file,
            Problems problems ) throws IOException {
  importFrom(IoUtil.read(file), problems, file.getCanonicalPath());
}

代码示例来源:origin: org.modeshape/modeshape-graph

/**
 * {@inheritDoc}
 */
public String create( Reader reader,
           long approximateLength ) throws IoException {
  if (reader == null) return null;
  try {
    return IoUtil.read(reader);
  } catch (IOException err) {
    throw new IoException(GraphI18n.errorConvertingIo.text(Reader.class.getSimpleName(), String.class.getSimpleName()),
               err);
  }
}

代码示例来源:origin: org.modeshape/modeshape-graph

@Override
@Before
public void beforeEach() throws Exception {
  super.beforeEach();
  // Load in the large value ...
  validLargeValues = new String[] {IoUtil.read(getClass().getClassLoader().getResourceAsStream("LoremIpsum1.txt")),
    IoUtil.read(getClass().getClassLoader().getResourceAsStream("LoremIpsum2.txt")),
    IoUtil.read(getClass().getClassLoader().getResourceAsStream("LoremIpsum3.txt"))};
}

代码示例来源:origin: org.modeshape/modeshape-graph

@Override
@Before
public void beforeEach() throws Exception {
  super.beforeEach();
  // Load in the large value ...
  validLargeValues = new String[] {IoUtil.read(getClass().getClassLoader().getResourceAsStream("LoremIpsum1.txt")),
    IoUtil.read(getClass().getClassLoader().getResourceAsStream("LoremIpsum2.txt")),
    IoUtil.read(getClass().getClassLoader().getResourceAsStream("LoremIpsum3.txt"))};
}

代码示例来源:origin: org.modeshape/modeshape-graph

@Override
@Before
public void beforeEach() throws Exception {
  super.beforeEach();
  // Load in the large value ...
  validLargeValues = new String[] {IoUtil.read(getClass().getClassLoader().getResourceAsStream("LoremIpsum1.txt")),
    IoUtil.read(getClass().getClassLoader().getResourceAsStream("LoremIpsum2.txt")),
    IoUtil.read(getClass().getClassLoader().getResourceAsStream("LoremIpsum3.txt"))};
}

代码示例来源:origin: ModeShape/modeshape

private void loadExpectedFrom( String resourcePath ) throws IOException {
  InputStream stream = getClass().getClassLoader().getResourceAsStream(resourcePath);
  assertThat(stream, is(notNullValue()));
  try {
    addWords(expected, IoUtil.read(stream));
  } finally {
    stream.close();
  }
}

代码示例来源:origin: ModeShape/modeshape

@Test
public void readShouldReturnEmptyStringForNullReader() throws Exception {
  assertThat(IoUtil.read((Reader)null), is(""));
}

相关文章

微信公众号

最新文章

更多