G
gast
Gast
Das ist auch schon die frage
Ist es auch möglich anstat ein Byte weiter zu gehen, ein byte zurückzukommen?
MfG
Ist es auch möglich anstat ein Byte weiter zu gehen, ein byte zurückzukommen?
MfG
public static void main(String[] args) throws IOException {
String nameByteFile = "test.data";
FileInputStream input = new FileInputStream(nameByteFile);
DataInputStream inputStream = new DataInputStream(input);
public static int nextByte(DataInputStream inputStream) throws IOException {
byte b = (byte) 0xff;
b = inputStream.readByte();
int tagByte = b & 0xff;
return tagByte;
}
RandomAccessFile in = new RandomAccessFile("test.datat");
long skip = -1;
byte b = (byte) 0xff;
b = in.seek(skip);
tagByte = b & 0xff;
return tagByte;
RandomAccess File in = new RandomAccessFile("test.datat","r"); //für nur lesen
in.seek(position); //hüpft auf die Position am File hin 0 = am Anfang, etc
//oder
in.skipBytes(bytes); //dort kannst nur nach hinten gehen
Modis hat gesagt.:"r" Open for reading only. Invoking any of the write methods of the resulting object will cause an IOException to be thrown.
"rw" Open for reading and writing. If the file does not already exist then an attempt will be made to create it.
"rws" Open for reading and writing, as with "rw", and also require that every update to the file's content or metadata be written synchronously to the underlying storage device.
"rwd" Open for reading and writing, as with "rw", and also require that every update to the file's content be written synchronously to the underlying storage device.
public static int write(DataInputStream inputStream, int tagByte) throws IOException {
long zahl = -1;
tagByte = (int) inputStream.skip(zahll);
return tagByte;