IDEA Auto Inspect

This commit is contained in:
Izzel_Aliz
2018-03-24 23:18:11 +08:00
parent 848b91f2e7
commit d4910db108
139 changed files with 1714 additions and 1814 deletions

View File

@@ -1,9 +1,9 @@
package me.skymc.taboolib.csvutils;
import java.nio.charset.*;
import java.text.*;
import java.io.*;
import java.util.*;
import java.nio.charset.Charset;
import java.text.NumberFormat;
import java.util.HashMap;
public class CsvReader
{
@@ -503,7 +503,6 @@ public class CsvReader
this.close();
throw new IOException("Maximum column length of 100,000 exceeded in column " + NumberFormat.getIntegerInstance().format(this.columnsCount) + " in record " + NumberFormat.getIntegerInstance().format(this.currentRecord) + ". Set the SafetySwitch property to false" + " if you're expecting column lengths greater than 100,000 characters to" + " avoid this error.");
}
continue;
}
} while (this.hasMoreData && this.startedColumn);
}
@@ -714,7 +713,6 @@ public class CsvReader
this.close();
throw new IOException("Maximum column length of 100,000 exceeded in column " + NumberFormat.getIntegerInstance().format(this.columnsCount) + " in record " + NumberFormat.getIntegerInstance().format(this.currentRecord) + ". Set the SafetySwitch property to false" + " if you're expecting column lengths greater than 100,000 characters to" + " avoid this error.");
}
continue;
}
} while (this.hasMoreData && this.startedColumn);
}
@@ -880,8 +878,8 @@ public class CsvReader
}
this.dataBuffer.ColumnStart = this.dataBuffer.Position + 1;
}
public void endRecord() throws IOException {
public void endRecord() {
this.hasReadNextLine = true;
++this.currentRecord;
}
@@ -960,8 +958,8 @@ public class CsvReader
if (this.initialized) {
this.inputStream.close();
}
} catch (Exception ignored) {
}
catch (Exception ex) {}
this.inputStream = null;
this.closed = true;
}

View File

@@ -1,7 +1,7 @@
package me.skymc.taboolib.csvutils;
import java.nio.charset.*;
import java.io.*;
import java.nio.charset.Charset;
public class CsvWriter
{
@@ -202,14 +202,22 @@ public class CsvWriter
}
this.firstColumn = true;
}
public void writeRecord(final String[] array, final boolean b) throws IOException {
if (array != null && array.length > 0) {
for (int i = 0; i < array.length; ++i) {
this.write(array[i], b);
public static String replace(final String s, final String s2, final String s3) {
final int length = s2.length();
int i = s.indexOf(s2);
if (i > -1) {
final StringBuilder sb = new StringBuilder();
int n;
for (n = 0; i != -1; i = s.indexOf(s2, n)) {
sb.append(s.substring(n, i));
sb.append(s3);
n = i + length;
}
this.endRecord();
sb.append(s.substring(n));
return sb.toString();
}
return s;
}
public void writeRecord(final String[] array) throws IOException {
@@ -247,6 +255,25 @@ public class CsvWriter
this.closed = true;
}
}
public void writeRecord(final String[] array, final boolean b) throws IOException {
if (array != null && array.length > 0) {
for (String anArray : array) {
this.write(anArray, b);
}
this.endRecord();
}
}
private void checkClosed() throws IOException {
if (this.closed) {
throw new IOException("This instance of the CsvWriter class has already been closed.");
}
}
protected void finalize() {
this.close(false);
}
private void close(final boolean b) {
if (!this.closed) {
@@ -257,40 +284,13 @@ public class CsvWriter
if (this.initialized) {
this.outputStream.close();
}
} catch (Exception ignored) {
}
catch (Exception ex) {}
this.outputStream = null;
this.closed = true;
}
}
private void checkClosed() throws IOException {
if (this.closed) {
throw new IOException("This instance of the CsvWriter class has already been closed.");
}
}
protected void finalize() {
this.close(false);
}
public static String replace(final String s, final String s2, final String s3) {
final int length = s2.length();
int i = s.indexOf(s2);
if (i > -1) {
final StringBuffer sb = new StringBuffer();
int n;
for (n = 0; i != -1; i = s.indexOf(s2, n)) {
sb.append(s.substring(n, i));
sb.append(s3);
n = i + length;
}
sb.append(s.substring(n));
return sb.toString();
}
return s;
}
private class UserSettings
{
public char TextQualifier;