You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uima.apache.org by pk...@apache.org on 2016/07/26 08:21:57 UTC
svn commit: r1754082 -
/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/util/CasIOUtils.java
Author: pkluegl
Date: Tue Jul 26 08:21:57 2016
New Revision: 1754082
URL: http://svn.apache.org/viewvc?rev=1754082&view=rev
Log:
UIMA-4685
- fix javadocs
Modified:
uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/util/CasIOUtils.java
Modified: uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/util/CasIOUtils.java
URL: http://svn.apache.org/viewvc/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/util/CasIOUtils.java?rev=1754082&r1=1754081&r2=1754082&view=diff
==============================================================================
--- uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/util/CasIOUtils.java (original)
+++ uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/util/CasIOUtils.java Tue Jul 26 08:21:57 2016
@@ -61,7 +61,9 @@ public class CasIOUtils {
* The path containing the CAS
* @param aCAS
* The CAS that should be filled
+ * @return the SerialFormat of the loaded CAS
* @throws IOException
+ * - Problem loading from given Path
*/
public static SerialFormat load(Path casPath, CAS aCAS) throws IOException {
@@ -76,9 +78,11 @@ public class CasIOUtils {
* The optional path containing the type system
* @param aCAS
* The CAS that should be filled
- * @param lentiently
+ * @param leniently
* ignore feature structures of non-existing types
+ * @return the SerialFormat of the loaded CAS
* @throws IOException
+ * - Problem loading from given Path
*/
public static SerialFormat load(Path casPath, Path tsPath, CAS aCAS, boolean leniently)
throws IOException {
@@ -94,7 +98,9 @@ public class CasIOUtils {
* The file containing the CAS
* @param aCAS
* The CAS that should be filled
+ * @return the SerialFormat of the loaded CAS
* @throws IOException
+ * - Problem loading from given File
*/
public static SerialFormat load(File casFile, CAS aCAS) throws IOException {
@@ -109,16 +115,18 @@ public class CasIOUtils {
* The optional file containing the type system
* @param aCAS
* The CAS that should be filled
- * @param lentiently
+ * @param leniently
* ignore feature structures of non-existing types
+ * @return the SerialFormat of the loaded CAS
* @throws IOException
+ * - Problem loading from given File
*/
- public static SerialFormat load(File casFile, File tsFile, CAS aCAS, boolean lentiently)
+ public static SerialFormat load(File casFile, File tsFile, CAS aCAS, boolean leniently)
throws IOException {
URL casUrl = casFile.toURI().toURL();
URL tsUrl = tsFile == null ? null : tsFile.toURI().toURL();
- return load(casUrl, tsUrl, aCAS, lentiently);
+ return load(casUrl, tsUrl, aCAS, leniently);
}
/**
@@ -127,7 +135,9 @@ public class CasIOUtils {
* The url containing the CAS
* @param aCAS
* The CAS that should be filled
+ * @return the SerialFormat of the loaded CAS
* @throws IOException
+ * - Problem loading from given URL
*/
public static SerialFormat load(URL casUrl, CAS aCAS) throws IOException {
@@ -142,23 +152,25 @@ public class CasIOUtils {
* The optional url containing the type system
* @param aCAS
* The CAS that should be filled
- * @param lentiently
+ * @param leniently
* ignore feature structures of non-existing types
+ * @return the SerialFormat of the loaded CAS
* @throws IOException
+ * - Problem loading from given URL
*/
- public static SerialFormat load(URL casUrl, URL tsUrl, CAS aCAS, boolean lentietly)
+ public static SerialFormat load(URL casUrl, URL tsUrl, CAS aCAS, boolean leniently)
throws IOException {
String path = casUrl.getPath().toLowerCase();
if (path.endsWith(".xmi")) {
try {
- XmiCasDeserializer.deserialize(casUrl.openStream(), aCAS, lentietly);
+ XmiCasDeserializer.deserialize(casUrl.openStream(), aCAS, leniently);
return SerialFormat.XMI;
} catch (SAXException e) {
throw new IOException(e);
}
} else if (path.endsWith(".xcas") || path.endsWith(".xml")) {
try {
- XCASDeserializer.deserialize(casUrl.openStream(), aCAS, lentietly);
+ XCASDeserializer.deserialize(casUrl.openStream(), aCAS, leniently);
return SerialFormat.XCAS;
} catch (SAXException e) {
throw new IOException(e);
@@ -175,7 +187,9 @@ public class CasIOUtils {
* The input stream containing the CAS
* @param aCAS
* The CAS that should be filled
+ * @return the SerialFormat of the loaded CAS
* @throws IOException
+ * - Problem loading from given InputStream
*/
public static SerialFormat load(InputStream casInputStream, CAS aCAS) throws IOException {
return load(casInputStream, null, aCAS, false);
@@ -191,12 +205,15 @@ public class CasIOUtils {
* The optional input stream containing the type system
* @param aCAS
* The CAS that should be filled
- * @param lentiently
+ * @param leniently
* ignore feature structures of non-existing types
+ * @return the SerialFormat of the loaded CAS
* @throws IOException
+ * - Problem loading from given InputStream
+ * @throws IllegalArgumentException - when trying to load XCAS
*/
public static SerialFormat load(InputStream casInputStream, InputStream tsInputStream, CAS aCAS,
- boolean lentiently) throws IOException {
+ boolean leniently) throws IOException {
BufferedInputStream bis = new BufferedInputStream(casInputStream);
bis.mark(32);
byte[] headerXml = new byte[16];
@@ -205,7 +222,7 @@ public class CasIOUtils {
String start = new String(headerXml);
if (start.startsWith("<?xml ")) {
try {
- XmiCasDeserializer.deserialize(bis, aCAS, lentiently);
+ XmiCasDeserializer.deserialize(bis, aCAS, leniently);
return SerialFormat.XMI;
} catch (SAXException e) {
throw new IllegalArgumentException(
@@ -222,7 +239,9 @@ public class CasIOUtils {
* The input stream of the CAS
* @param aCAS
* the CAS in which the inpout stream will be deserialized
+ * @return the SerialFormat of the loaded CAS
* @throws IOException
+ * - Problem loading from given InputStream
*/
public static SerialFormat loadBinary(InputStream is, CAS aCAS) throws IOException {
return loadBinary(is, (CASMgrSerializer) null, aCAS);
@@ -239,7 +258,9 @@ public class CasIOUtils {
* typesystem information.
* @param aCAS
* the CAS in which the input stream will be deserialized
+ * @return the SerialFormat of the loaded CAS
* @throws IOException
+ * - Problem loading from given InputStream
*/
public static SerialFormat loadBinary(InputStream is, InputStream typeIS, CAS aCAS)
throws IOException {
@@ -261,7 +282,9 @@ public class CasIOUtils {
* primary input stream does not already contain typesystem information.
* @param aCAS
* the CAS in which the input stream will be deserialized
+ * @return the SerialFormat of the loaded CAS
* @throws IOException
+ * - Problem loading from given InputStream
*/
public static SerialFormat loadBinary(InputStream is, CASMgrSerializer casMgr, CAS aCAS)
throws IOException {
@@ -353,6 +376,7 @@ public class CasIOUtils {
* @param formatName
* The format string in which the CAS should be stored.
* @throws IOException
+ * - Problem saving to the given InputStream
*/
public static void save(CAS aCas, OutputStream docOS, String formatName) throws IOException {
SerialFormat format = SerialFormat.valueOf(formatName);
@@ -369,6 +393,7 @@ public class CasIOUtils {
* @param format
* The SerialFormat in which the CAS should be stored.
* @throws IOException
+ * - Problem saving to the given InputStream
*/
public static void save(CAS aCas, OutputStream docOS, SerialFormat format) throws IOException {
save(aCas, docOS, null, format);
@@ -389,6 +414,7 @@ public class CasIOUtils {
* @param format
* The SerialFormat in which the CAS should be stored.
* @throws IOException
+ * - Problem saving to the given InputStream
*/
public static void save(CAS aCas, OutputStream docOS, OutputStream typeOS, SerialFormat format)
throws IOException {