Package java.io

Examples of java.io.DataInputStream.mark()


    {
      try
      {
        DataInputStream data = new DataInputStream(in);
        byte[] b = new byte[3];
        data.mark(b.length);
        data.readFully(b);
        if (b[0] == 'C' && b[1] == 'W' && b[2] == 'S' ||
                    b[0] == 'F' && b[1] == 'W' && b[2] == 'S')
        {
          data.reset();
View Full Code Here


  @SuppressWarnings("rawtypes")
  public ImageHeader decodeImageHeader(InputStream is) throws IOException {
    ImageHeader header = new ImageHeader(ImageType.JPEG_IMAGE);
    try {
      DataInputStream dis = new DataInputStream(new BufferedInputStream(is));
      dis.mark(Integer.MAX_VALUE);
      short magic = dis.readShort();
      if (magic != -40)
        return null;
      byte[] data = new byte[6];
      // read in each block to find width / height / bitDepth
View Full Code Here

    long startTime = FSNamesystem.now();

    DataInputStream in = new DataInputStream(new BufferedInputStream(edits));
    try {
      // Read log file version. Could be missing.
      in.mark(4);
      // If edits log is greater than 2G, available method will return negative
      // numbers, so we avoid having to call available
      boolean available = true;
      try {
        logVersion = in.readByte();
View Full Code Here

    if (edits != null) {
      DataInputStream in = new DataInputStream(
                                               new BufferedInputStream(
                                                                       new FileInputStream(edits)));
      // Read log file version. Could be missing.
      in.mark(4);
      // If edits log is greater than 2G, available method will return negative
      // numbers, so we avoid having to call available
      boolean available = true;
      try {
        logVersion = in.readByte();
View Full Code Here

    Arrays.fill(recentOpcodeOffsets, -1);

    DataInputStream in = new DataInputStream(tracker);
    try {
      // Read log file version. Could be missing.
      in.mark(4);
      // If edits log is greater than 2G, available method will return negative
      // numbers, so we avoid having to call available
      boolean available = true;
      try {
        logVersion = in.readByte();
View Full Code Here

    final boolean isTolerationEnabled = tolerationLength >= 0;
    DataInputStream in = new DataInputStream(tracker);
    Byte opcode = null;
    try {
      // Read log file version. Could be missing.
      in.mark(4);
      // If edits log is greater than 2G, available method will return negative
      // numbers, so we avoid having to call available
      boolean available = true;
      try {
        logVersion = in.readByte();
View Full Code Here

                            "Unsupported version " + logVersion;

      while (true) {
        if (isTolerationEnabled) {
          //mark position could be reset in case of exceptions
          in.mark(TRANSACTION_LENGTH_LIMIT);
        }

        long timestamp = 0;
        long mtime = 0;
        long atime = 0;
View Full Code Here

        AudioFormat.Encoding encoding = null;

        DataInputStream dis = new DataInputStream( stream );

        if (doReset) {
            dis.mark(MAX_READ_LENGTH);
        }

        int magic = dis.readInt();
        int fileLength = rllong(dis);
        int waveMagic = dis.readInt();
View Full Code Here

        int nread = 0;
        AudioFormat.Encoding encoding = null;

        DataInputStream dis = new DataInputStream( stream );

        dis.mark(maxReadLength);

        magic = dis.readInt();

        if (! (magic == AuFileFormat.AU_SUN_MAGIC) || (magic == AuFileFormat.AU_DEC_MAGIC) ||
            (magic == AuFileFormat.AU_SUN_INV_MAGIC) || (magic == AuFileFormat.AU_DEC_INV_MAGIC) ) {
View Full Code Here

        throws UnsupportedAudioFileException, IOException {

        DataInputStream dis = new DataInputStream(is);

        if (doReset) {
            dis.mark(MAX_READ_LENGTH);
        }

        // assumes a stream at the beginning of the file which has already
        // passed the magic number test...
        // leaves the input stream at the beginning of the audio data
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.