本文整理了Java中java.io.RandomAccessFile.consolidate
方法的一些代码示例,展示了RandomAccessFile.consolidate
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。RandomAccessFile.consolidate
方法的具体详情如下:
包路径:java.io.RandomAccessFile
类名称:RandomAccessFile
方法名:consolidate
暂无
代码示例来源:origin: libgdx/libgdx
@Override
public int read () throws IOException {
if (pos >= len) {
return -1;
} else {
consolidate();
return data.charAt(pos++);
// int p2 = (pos << 1);
// int result = Character.digit(data.charAt(p2), 16) * 16 +
// Character.digit(data.charAt(p2 + 1), 16);
// pos++;
// return result;
}
}
}
代码示例来源:origin: libgdx/libgdx
@Override
public int read () throws IOException {
if (pos >= len) {
return -1;
} else {
consolidate();
return data.charAt(pos++);
// int p2 = (pos << 1);
// int result = Character.digit(data.charAt(p2), 16) * 16 +
// Character.digit(data.charAt(p2 + 1), 16);
// pos++;
// return result;
}
}
}
代码示例来源:origin: libgdx/libgdx
public void setLength (long newLength) throws IOException {
if (len != newLength) {
consolidate();
if (data.length() > newLength) {
data = data.substring(0, (int)newLength);
len = (int)newLength;
} else {
// System.out.println("padding " + (newLength - len) + " zeros in setLength to " + newLength);
while (len < newLength) {
write(0);
}
}
}
}
代码示例来源:origin: libgdx/libgdx
public void setLength (long newLength) throws IOException {
if (len != newLength) {
consolidate();
if (data.length() > newLength) {
data = data.substring(0, (int)newLength);
len = (int)newLength;
} else {
// System.out.println("padding " + (newLength - len) + " zeros in setLength to " + newLength);
while (len < newLength) {
write(0);
}
}
}
}
代码示例来源:origin: libgdx/libgdx
public void write (int b) throws IOException {
if (!writeable) {
throw new IOException("not writeable");
}
if (newData == null) {
newDataPos = pos;
newData = new StringBuilder();
// System.out.println("no buf; newDataPos: " + pos);
} else if (newDataPos + newData.length() != pos) {
consolidate();
newDataPos = pos;
newData = new StringBuilder();
// System.out.println("pos mismatch; newDataPos: " + pos);
}
newData.append((char)(b & 255));
// newData.append("" + Character.forDigit((b >> 4) & 15, 16) +
// Character.forDigit(b & 15, 16));
pos++;
len = Math.max(pos, len);
dirty = true;
}
}
代码示例来源:origin: libgdx/libgdx
public void write (int b) throws IOException {
if (!writeable) {
throw new IOException("not writeable");
}
if (newData == null) {
newDataPos = pos;
newData = new StringBuilder();
// System.out.println("no buf; newDataPos: " + pos);
} else if (newDataPos + newData.length() != pos) {
consolidate();
newDataPos = pos;
newData = new StringBuilder();
// System.out.println("pos mismatch; newDataPos: " + pos);
}
newData.append((char)(b & 255));
// newData.append("" + Character.forDigit((b >> 4) & 15, 16) +
// Character.forDigit(b & 15, 16));
pos++;
len = Math.max(pos, len);
dirty = true;
}
}
代码示例来源:origin: libgdx/libgdx
void flush () throws IOException {
if (!dirty) {
return;
}
consolidate();
File.LocalStorage.setItem(name, btoa(data));
dirty = false;
}
代码示例来源:origin: libgdx/libgdx
void flush () throws IOException {
if (!dirty) {
return;
}
consolidate();
File.LocalStorage.setItem(name, btoa(data));
dirty = false;
}
代码示例来源:origin: thothbot/parallax
@Override
public int read () throws IOException {
if (pos >= len) {
return -1;
} else {
consolidate();
return data.charAt(pos++);
// int p2 = (pos << 1);
// int result = Character.digit(data.charAt(p2), 16) * 16 +
// Character.digit(data.charAt(p2 + 1), 16);
// pos++;
// return result;
}
}
}
代码示例来源:origin: thothbot/parallax
public void setLength (long newLength) throws IOException {
if (len != newLength) {
consolidate();
if (data.length() > newLength) {
data = data.substring(0, (int)newLength);
len = (int)newLength;
} else {
// System.out.println("padding " + (newLength - len) + " zeros in setLength to " + newLength);
while (len < newLength) {
write(0);
}
}
}
}
代码示例来源:origin: thothbot/parallax
public void write (int b) throws IOException {
if (!writeable) {
throw new IOException("not writeable");
}
if (newData == null) {
newDataPos = pos;
newData = new StringBuilder();
// System.out.println("no buf; newDataPos: " + pos);
} else if (newDataPos + newData.length() != pos) {
consolidate();
newDataPos = pos;
newData = new StringBuilder();
// System.out.println("pos mismatch; newDataPos: " + pos);
}
newData.append((char)(b & 255));
// newData.append("" + Character.forDigit((b >> 4) & 15, 16) +
// Character.forDigit(b & 15, 16));
pos++;
len = Math.max(pos, len);
dirty = true;
}
}
代码示例来源:origin: thothbot/parallax
void flush () throws IOException {
if (!dirty) {
return;
}
consolidate();
File.LocalStorage.setItem(name, btoa(data));
dirty = false;
}
内容来源于网络,如有侵权,请联系作者删除!