/** * 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); }
/** * 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); }
/** * 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); }
/** * 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); }
/** * 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); }
/** * 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); }
/** * 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); }
/** * 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); }
/** * 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); }
/** * 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); }
/** * 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); }
/** * 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); }
/** * 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); }
/** * 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 {
/** * 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 {
/** * 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 {
/** * 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 {
/** * 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); }
/** * 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); }
@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); } }