本文整理了Java中org.eclipse.jdt.internal.compiler.util.Util.getInputStreamAsCharArray()
方法的一些代码示例,展示了Util.getInputStreamAsCharArray()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Util.getInputStreamAsCharArray()
方法的具体详情如下:
包路径:org.eclipse.jdt.internal.compiler.util.Util
类名称:Util
方法名:getInputStreamAsCharArray
[英]Returns the given input stream's contents as a character array. If a length is specified (i.e. if length != -1), this represents the number of bytes in the stream. Note this doesn't close the stream.
[中]以字符数组的形式返回给定输入流的内容。如果指定了长度(即如果长度!=-1),则表示流中的字节数。注意,这不会关闭流。
代码示例来源:origin: ModeShape/modeshape
/**
* Gets Java source from the <code>InputStream</code>.
*
* @param inputStream - the <code>FileInputStream</code>.
* @param length - the length of the java file.
* @param encoding - the encoding of the source, if there is one.
* @return the array character of the java source.
* @throws java.io.IOException - exceptional error can be thrown during the reading of the file.
*/
public static char[] getJavaSourceFromTheInputStream( InputStream inputStream,
long length,
String encoding ) throws IOException {
return Util.getInputStreamAsCharArray(inputStream, (int)length, encoding);
}
代码示例来源:origin: org.modeshape/modeshape-sequencer-java
/**
* Gets Java source from the <code>InputStream</code>.
*
* @param inputStream - the <code>FileInputStream</code>.
* @param length - the length of the java file.
* @param encoding - the encoding of the source, if there is one.
* @return the array character of the java source.
* @throws java.io.IOException - exceptional error can be thrown during the reading of the file.
*/
public static char[] getJavaSourceFromTheInputStream( InputStream inputStream,
long length,
String encoding ) throws IOException {
return Util.getInputStreamAsCharArray(inputStream, (int)length, encoding);
}
代码示例来源:origin: org.eclipse.jdt.core.compiler/ecj
/**
* Returns the given bytes as a char array using a given encoding (null means platform default).
*/
public static char[] bytesToChar(byte[] bytes, String encoding) throws IOException {
return getInputStreamAsCharArray(new ByteArrayInputStream(bytes), bytes.length, encoding);
}
代码示例来源:origin: org.eclipse.tycho/org.eclipse.jdt.core
/**
* Returns the given bytes as a char array using a given encoding (null means platform default).
*/
public static char[] bytesToChar(byte[] bytes, String encoding) throws IOException {
return getInputStreamAsCharArray(new ByteArrayInputStream(bytes), bytes.length, encoding);
}
代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.core
/**
* Returns the given bytes as a char array using a given encoding (null means platform default).
*/
public static char[] bytesToChar(byte[] bytes, String encoding) throws IOException {
return getInputStreamAsCharArray(new ByteArrayInputStream(bytes), bytes.length, encoding);
}
代码示例来源:origin: com.vaadin/vaadin-client-compiler-deps
/**
* Returns the given bytes as a char array using a given encoding (null means platform default).
*/
public static char[] bytesToChar(byte[] bytes, String encoding) throws IOException {
return getInputStreamAsCharArray(new ByteArrayInputStream(bytes), bytes.length, encoding);
}
代码示例来源:origin: com.ovea.tajin.server/tajin-server-tomcat7
/**
* Returns the given bytes as a char array using a given encoding (null means platform default).
*/
public static char[] bytesToChar(byte[] bytes, String encoding) throws IOException {
return getInputStreamAsCharArray(new ByteArrayInputStream(bytes), bytes.length, encoding);
}
代码示例来源:origin: com.google.code.maven-play-plugin.org.eclipse.jdt/org.eclipse.jdt.core
/**
* Returns the given bytes as a char array using a given encoding (null means platform default).
*/
public static char[] bytesToChar(byte[] bytes, String encoding) throws IOException {
return getInputStreamAsCharArray(new ByteArrayInputStream(bytes), bytes.length, encoding);
}
代码示例来源:origin: org.jibx.config.3rdparty.org.eclipse/org.eclipse.jdt.core
/**
* Returns the given bytes as a char array using a given encoding (null means platform default).
*/
public static char[] bytesToChar(byte[] bytes, String encoding) throws IOException {
return getInputStreamAsCharArray(new ByteArrayInputStream(bytes), bytes.length, encoding);
}
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.core
/**
* Returns the given bytes as a char array using a given encoding (null means platform default).
*/
public static char[] bytesToChar(byte[] bytes, String encoding) throws IOException {
return getInputStreamAsCharArray(new ByteArrayInputStream(bytes), bytes.length, encoding);
}
代码示例来源:origin: trylimits/Eclipse-Postfix-Code-Completion
/**
* Returns the given bytes as a char array using a given encoding (null means platform default).
*/
public static char[] bytesToChar(byte[] bytes, String encoding) throws IOException {
return getInputStreamAsCharArray(new ByteArrayInputStream(bytes), bytes.length, encoding);
}
代码示例来源:origin: org.eclipse.jetty.orbit/org.eclipse.jdt.core
/**
* Returns the given bytes as a char array using a given encoding (null means platform default).
*/
public static char[] bytesToChar(byte[] bytes, String encoding) throws IOException {
return getInputStreamAsCharArray(new ByteArrayInputStream(bytes), bytes.length, encoding);
}
代码示例来源:origin: org.eclipse.scout.sdk.deps/ecj
/**
* Returns the given bytes as a char array using a given encoding (null means platform default).
*/
public static char[] bytesToChar(byte[] bytes, String encoding) throws IOException {
return getInputStreamAsCharArray(new ByteArrayInputStream(bytes), bytes.length, encoding);
}
代码示例来源:origin: org.eclipse.jdt.core.compiler/ecj
/**
* Returns the contents of the given file as a char array.
* When encoding is null, then the platform default one is used
* @throws IOException if a problem occured reading the file.
*/
public static char[] getFileCharContent(File file, String encoding) throws IOException {
InputStream stream = null;
try {
stream = new FileInputStream(file);
return getInputStreamAsCharArray(stream, (int) file.length(), encoding);
} finally {
if (stream != null) {
try {
stream.close();
} catch (IOException e) {
// ignore
}
}
}
}
private static FileOutputStream getFileOutputStream(boolean generatePackagesStructure, String outputPath, String relativeFileName) throws IOException {
代码示例来源:origin: org.eclipse.jetty.orbit/org.eclipse.jdt.core
/**
* Returns the contents of the given file as a char array.
* When encoding is null, then the platform default one is used
* @throws IOException if a problem occured reading the file.
*/
public static char[] getFileCharContent(File file, String encoding) throws IOException {
InputStream stream = null;
try {
stream = new FileInputStream(file);
return getInputStreamAsCharArray(stream, (int) file.length(), encoding);
} finally {
if (stream != null) {
try {
stream.close();
} catch (IOException e) {
// ignore
}
}
}
}
private static FileOutputStream getFileOutputStream(boolean generatePackagesStructure, String outputPath, String relativeFileName) throws IOException {
代码示例来源:origin: com.ovea.tajin.server/tajin-server-tomcat7
/**
* Returns the contents of the given file as a char array.
* When encoding is null, then the platform default one is used
* @throws IOException if a problem occured reading the file.
*/
public static char[] getFileCharContent(File file, String encoding) throws IOException {
InputStream stream = null;
try {
stream = new FileInputStream(file);
return getInputStreamAsCharArray(stream, (int) file.length(), encoding);
} finally {
if (stream != null) {
try {
stream.close();
} catch (IOException e) {
// ignore
}
}
}
}
private static FileOutputStream getFileOutputStream(boolean generatePackagesStructure, String outputPath, String relativeFileName) throws IOException {
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.core
/**
* Returns the contents of the given file as a char array.
* When encoding is null, then the platform default one is used
* @throws IOException if a problem occured reading the file.
*/
public static char[] getFileCharContent(File file, String encoding) throws IOException {
InputStream stream = null;
try {
stream = new FileInputStream(file);
return getInputStreamAsCharArray(stream, (int) file.length(), encoding);
} finally {
if (stream != null) {
try {
stream.close();
} catch (IOException e) {
// ignore
}
}
}
}
private static FileOutputStream getFileOutputStream(boolean generatePackagesStructure, String outputPath, String relativeFileName) throws IOException {
代码示例来源:origin: org.eclipse.tycho/org.eclipse.jdt.core
/**
* Analyzes the manifest contents. The given input stream is read using a UTF-8 encoded reader.
* If the contents of the input stream is not encoded using a UTF-8 encoding, the analysis will fail.
*
* @param inputStream the given input stream.
*
* @return <code>true</code> if the analysis is successful, <code>false</code> otherwise.
* @throws IOException if an exception occurs while analyzing the file
*/
public boolean analyzeManifestContents(InputStream inputStream) throws IOException {
char[] chars = Util.getInputStreamAsCharArray(inputStream, -1, Util.UTF_8);
return analyzeManifestContents(chars);
}
代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.core
/**
* Analyzes the manifest contents. The given input stream is read using a UTF-8 encoded reader.
* If the contents of the input stream is not encoded using a UTF-8 encoding, the analysis will fail.
*
* @param inputStream the given input stream.
*
* @return <code>true</code> if the analysis is successful, <code>false</code> otherwise.
* @throws IOException if an exception occurs while analyzing the file
*/
public boolean analyzeManifestContents(InputStream inputStream) throws IOException {
char[] chars = Util.getInputStreamAsCharArray(inputStream, -1, Util.UTF_8);
return analyzeManifestContents(chars);
}
代码示例来源:origin: org.jboss.forge/roaster-jdt
@Override
public JavaType<?> parse(final InputStream data)
{
try
{
char[] source = Util.getInputStreamAsCharArray(data, data.available(), "ISO8859_1");
return parse(new String(source));
}
catch (IOException e)
{
return null;
}
finally
{
Streams.closeQuietly(data);
}
}
内容来源于网络,如有侵权,请联系作者删除!