/** * 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; } }
/** * 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; } }
/** * 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]); } }
@Override public void writeUTF(String s) throws IOException { try { getRaf().writeUTF(s); } catch (IOException ioe) { handleException(); throw ioe; } }
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)); } }
fh.writeUTF(str); System.err.println("Wrote: " + str);
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
/** * 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); } }
@Override public final void writeUTF(String s) throws IOException { randomAccessFile.writeUTF(s); } }
@Override public void writeUTF(final String str) throws IOException { raf.writeUTF(str); }
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); }
@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; }
@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; }
public void writeLine(String line) throws Exception { synchronized (mutex) { if (dbUuid == null) { throw new InternalException("Not initialized"); } repoUuidRaf.seek(0); repoUuidRaf.writeUTF(line); } }
private void storeSenderSequenceNumber() throws IOException { senderSequenceNumberFile.seek(0); senderSequenceNumberFile.writeUTF("" + cache.getNextSenderMsgSeqNum()); }
private void storeTargetSequenceNumber() throws IOException { targetSequenceNumberFile.seek(0); targetSequenceNumberFile.writeUTF("" + cache.getNextTargetMsgSeqNum()); }
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()); }
@Override public void writeUTF(String s) throws IOException { try { getRaf().writeUTF(s); } catch (IOException ioe) { handleException(); throw ioe; } }
@Override public void writeUTF(String s) throws IOException { try { getRaf().writeUTF(s); } catch (IOException ioe) { handleException(); throw ioe; } }
@Test(expected = FileReactiveAuditException.class) public void writeUTF() throws IOException { ReactiveAudit.off.commit(); try (RandomAccessFile rw = newRandomAccessFile()) { TestTools.strict.commit(); rw.writeUTF(""); } }