/** * Writes a big-endian 16-bit character to this file, starting at the current file * pointer. Only the two least significant bytes of the integer {@code val} * are written, with the high byte first. * * @param val * the char to write to this file. * @throws IOException * if an I/O error occurs while writing to this file. * @see #readChar() */ public final void writeChar(int val) throws IOException { writeShort(val); }
@Override public Bytes writeShort(int offset, short s) { checkWrite(offset, SHORT); try { seekToOffset(offset); randomAccessFile.writeShort(s); } catch (IOException e) { throw new RuntimeException(e); } return this; }
@Override public void writeShort(int i) throws IOException { try { getRaf().writeShort(i); } catch (IOException ioe) { handleException(); throw ioe; } }
randomAccessWriter.writeBytes("fmt "); randomAccessWriter.writeInt(Integer.reverseBytes(16)); // Sub-chunk size, 16 for PCM randomAccessWriter.writeShort(Short.reverseBytes((short) 1)); // AudioFormat, 1 for PCM randomAccessWriter.writeShort(Short.reverseBytes(nChannels));// Number of channels, 1 for mono, 2 for stereo randomAccessWriter.writeShort(Short.reverseBytes((short)(nChannels*bSamples/8))); // Block align, NumberOfChannels*BitsPerSample/8 randomAccessWriter.writeShort(Short.reverseBytes(bSamples)); // Bits per sample randomAccessWriter.writeBytes("data"); randomAccessWriter.writeInt(0); // Data chunk size not known yet, write 0
public void writeShort(int v) throws IOException { delegate.writeShort(v); } public void writeChar(int v) throws IOException { delegate.writeChar(v); }
raf.writeByte((Byte) value); } else if (binding == Short.class || binding == short.class) { raf.writeShort((Short) value); } else if (binding == Integer.class || binding == int.class) { raf.writeInt((Integer) value);
/** Write an ICCDateTime to a file. */ public void write (RandomAccessFile raf) throws IOException { raf.writeShort(wYear); raf.writeShort(wMonth); raf.writeShort(wDay); raf.writeShort(wHours); raf.writeShort(wMinutes); raf.writeShort(wSeconds); }
@Override public void writeShort(final int v) throws IOException { raf.writeShort(v); }
protected final void writeLittleShort( int i ) throws IOException { raf.writeShort( (i >> 8) | ((i & 0xFF) << 8) ); }
synchronized public void log(int streamId, ByteBuffer buf) throws IOException { this.raf.writeShort(MAGIC); this.raf.writeInt(streamId); this.raf.writeInt(buf.remaining()); this.raf.getChannel().write(buf); }
private void writeFileSetConsistencyFlag(int flag) throws IOException { raf.seek(firstRecordPos - 14); raf.writeShort(flag); setFileSetConsistencyFlag(flag); }
File myFile = new File (filename); //Create the accessor with read-write access. RandomAccessFile accessor = new RandomAccessFile (myFile, "rws"); int lastNumBytes = 26; long startingPosition = accessor.length() - lastNumBytes; accessor.seek(startingPosition); accessor.writeInt(x); accessor.writeShort(y); accessor.writeByte(z); accessor.close();
public DBT_fpt(DBF iDBF, String name, boolean destroy) throws IOException, xBaseJException { super(iDBF, name, destroy, DBF.FOXPRO_WITH_MEMO); nextBlock = 8; file.writeInt(nextBlock); file.writeByte(0); file.writeByte(0); memoBlockSize = 64; file.writeShort(memoBlockSize); for (int i = 0; i < 504; i += 4) file.writeInt(0); }
@Override public Bytes writeShort(int offset, short s) { checkWrite(offset, SHORT); try { seekToOffset(offset); randomAccessFile.writeShort(s); } catch (IOException e) { throw new RuntimeException(e); } return this; }
@Override public Bytes writeShort(int offset, short s) { checkWrite(offset, SHORT); try { seekToOffset(offset); randomAccessFile.writeShort(s); } catch (IOException e) { throw new RuntimeException(e); } return this; }
@Override public Bytes writeShort(long offset, short s) { checkWrite(offset, SHORT); try { seekToOffset(offset); randomAccessFile.writeShort(s); } catch (IOException e) { throw new RuntimeException(e); } return this; }
@Override public void writeShort(int i) throws IOException { try { getRaf().writeShort(i); } catch (IOException ioe) { handleException(); throw ioe; } }
/** * Writes an unsigned short to the RandomAccessFile f. This method is a wrapper around {@link * java.io.RandomAccessFile#writeShort(int) writeShort(int)}, but assumes the input should be * interpreted as unsigned. */ @SuppressWarnings("signedness") public static void writeUnsignedShort(RandomAccessFile f, @Unsigned short s) throws IOException { f.writeShort(toUnsignedInt(s)); }
@Override public void writeShort(int i) throws IOException { try { getRaf().writeShort(i); } catch (IOException ioe) { handleException(); throw ioe; } }
@Test(expected = FileReactiveAuditException.class) public void writeShort() throws IOException { ReactiveAudit.off.commit(); try (RandomAccessFile rw = newRandomAccessFile()) { TestTools.strict.commit(); rw.writeShort(0); } }