本文整理了Java中java.io.RandomAccessFile.writeUTF
方法的一些代码示例,展示了RandomAccessFile.writeUTF
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。RandomAccessFile.writeUTF
方法的具体详情如下:
包路径:java.io.RandomAccessFile
类名称:RandomAccessFile
方法名:writeUTF
[英]Writes a string encoded with DataInput to this file, starting at the current file pointer.
[中]将使用DataInput编码的字符串写入此文件,从当前文件指针开始。
代码示例来源:origin: marytts/marytts
/**
* Method which writes the proc header to a RandomAccessFile.
*
* @param rafIn
* rafIn
* @throws IOException
* IOException
* @return the number of written bytes.
* */
public long dump(RandomAccessFile rafIn) throws IOException {
long before = rafIn.getFilePointer();
rafIn.writeUTF(procHeader);
long after = rafIn.getFilePointer();
return after - before;
}
}
代码示例来源:origin: marytts/marytts
/**
* Method which writes the proc header to a RandomAccessFile.
*
* @param rafIn
* rafIn
* @throws IOException
* IOException
* @return the number of written bytes.
* */
public long dump(RandomAccessFile rafIn) throws IOException {
long before = rafIn.getFilePointer();
rafIn.writeUTF(procHeader);
long after = rafIn.getFilePointer();
return after - before;
}
}
代码示例来源:origin: graphhopper/graphhopper
/**
* Writes some internal data into the beginning of the specified file.
*/
protected void writeHeader(RandomAccessFile file, long length, int segmentSize) throws IOException {
file.seek(0);
file.writeUTF("GH");
file.writeLong(length);
file.writeInt(segmentSize);
for (int i = 0; i < header.length; i++) {
file.writeInt(header[i]);
}
}
代码示例来源:origin: apache/activemq
@Override
public void writeUTF(String s) throws IOException {
try {
getRaf().writeUTF(s);
} catch (IOException ioe) {
handleException();
throw ioe;
}
}
代码示例来源:origin: lealone/Lealone
private synchronized void writeChunkMetaData(int lastChunkId, TreeSet<Long> removedPages) {
try {
chunkMetaData.setLength(0);
chunkMetaData.seek(0);
chunkMetaData.writeInt(lastChunkId);
chunkMetaData.writeInt(removedPages.size());
for (long pos : removedPages) {
chunkMetaData.writeLong(pos);
}
chunkMetaData.writeInt(hashCodeToHostIdMap.size());
for (String hostId : hashCodeToHostIdMap.values()) {
chunkMetaData.writeUTF(hostId);
}
// chunkMetaData.setLength(4 + 4 + removedPages.size() * 8);
chunkMetaData.getFD().sync();
} catch (IOException e) {
throw panic(DataUtils.newIllegalStateException(DataUtils.ERROR_WRITING_FAILED,
"Failed to writeChunkMetaData", e));
}
}
代码示例来源:origin: stackoverflow.com
fh.writeUTF(str);
System.err.println("Wrote: " + str);
代码示例来源:origin: geotools/geotools
raf.writeDouble((Double) value);
} else if (binding == String.class) {
raf.writeUTF((String) value);
} else if (binding == java.sql.Date.class
|| binding == java.sql.Time.class
代码示例来源:origin: geotools/geotools
/**
* Writes the feature to the file
*
* @param sf
* @throws IOException
*/
public void write(SimpleFeature sf) throws IOException {
// write each attribute in the random access file
List<AttributeDescriptor> attributes = schema.getAttributeDescriptors();
// write feature id
raf.writeUTF(sf.getID());
// write the attributes
for (AttributeDescriptor ad : attributes) {
Object value = sf.getAttribute(ad.getLocalName());
writeAttribute(ad, value);
}
}
代码示例来源:origin: cc.plural/jsonij
@Override
public final void writeUTF(String s) throws IOException {
randomAccessFile.writeUTF(s);
}
}
代码示例来源:origin: org.jetbrains.intellij.deps/commons-vfs2
@Override
public void writeUTF(final String str) throws IOException
{
raf.writeUTF(str);
}
代码示例来源:origin: stackoverflow.com
public static void main(String[] args) throws IOException {
int senderSequenceNumber=1910;
int targetSequenceNumber=2268;
RandomAccessFile file = new RandomAccessFile("C:\\filename.seqnums", "rw");
file.seek(0);
file.writeUTF("" + senderSequenceNumber + ':'+ targetSequenceNumber);
}
代码示例来源:origin: io.scif/scifio
@Override
public void writeUTF(final String str) throws IOException {
// NB: number of bytes written is greater than the length of the string
final int strlen = str.getBytes(Constants.ENCODING).length + 2;
writeSetup(strlen);
raf.seek(position);
raf.writeUTF(str);
position += strlen;
buffer = null;
}
代码示例来源:origin: ome/formats-common
@Override
public void writeUTF(String str) throws IOException {
// NB: number of bytes written is greater than the length of the string
int strlen = str.getBytes(Constants.ENCODING).length + 2;
writeSetup(strlen);
raf.seek(position);
raf.writeUTF(str);
position += strlen;
buffer = null;
}
代码示例来源:origin: omero/blitz
public void writeLine(String line) throws Exception {
synchronized (mutex) {
if (dbUuid == null) {
throw new InternalException("Not initialized");
}
repoUuidRaf.seek(0);
repoUuidRaf.writeUTF(line);
}
}
代码示例来源:origin: quickfix-j/quickfixj
private void storeSenderSequenceNumber() throws IOException {
senderSequenceNumberFile.seek(0);
senderSequenceNumberFile.writeUTF("" + cache.getNextSenderMsgSeqNum());
}
代码示例来源:origin: quickfix-j/quickfixj
private void storeTargetSequenceNumber() throws IOException {
targetSequenceNumberFile.seek(0);
targetSequenceNumberFile.writeUTF("" + cache.getNextTargetMsgSeqNum());
}
代码示例来源:origin: quickfix-j/quickfixj
private void storeSequenceNumbers() throws IOException {
sequenceNumberFile.seek(0);
// I changed this from explicitly using a StringBuffer because of
// recommendations from Sun. The performance also appears higher
// with this implementation. -- smb.
// http://bugs.sun.com/bugdatabase/view_bug.do;:WuuT?bug_id=4259569
sequenceNumberFile.writeUTF("" + cache.getNextSenderMsgSeqNum() + ':'
+ cache.getNextTargetMsgSeqNum());
}
代码示例来源:origin: org.apache.activemq/activemq-kahadb-store
@Override
public void writeUTF(String s) throws IOException {
try {
getRaf().writeUTF(s);
} catch (IOException ioe) {
handleException();
throw ioe;
}
}
代码示例来源:origin: org.apache.activemq/activemq-all
@Override
public void writeUTF(String s) throws IOException {
try {
getRaf().writeUTF(s);
} catch (IOException ioe) {
handleException();
throw ioe;
}
}
代码示例来源:origin: octo-online/reactive-audit
@Test(expected = FileReactiveAuditException.class)
public void writeUTF()
throws IOException
{
ReactiveAudit.off.commit();
try (RandomAccessFile rw = newRandomAccessFile())
{
TestTools.strict.commit();
rw.writeUTF("");
}
}
内容来源于网络,如有侵权,请联系作者删除!